package com.atlassian.bitbucket.internal.cluster;

import org.junit.Test;

import java.text.MessageFormat;
import java.util.Properties;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class ClusterInfoMessageTest {

    @Test
    public void singleNodeCluster() throws Exception {
        Properties properties = new Properties();
        properties.load(this.getClass().getClassLoader().getResourceAsStream("i18n/bitbucket-cluster-info.properties"));

        String message = MessageFormat.format(properties.getProperty("bitbucket.cluster.node"), "uuid", 1);

        assertThat(message, is("Generated by uuid. Cluster contains one node."));
    }

    @Test
    public void multipleNodeCluster() throws Exception {
        Properties properties = new Properties();
        properties.load(this.getClass().getClassLoader().getResourceAsStream("i18n/bitbucket-cluster-info.properties"));

        String message = MessageFormat.format(properties.getProperty("bitbucket.cluster.node"), "uuid", 2);

        assertThat(message, is("Generated by uuid. Cluster contains 2 nodes."));
    }
}
