Skip to content

Commit

Permalink
First pass at Symmetric Logger with internationalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanes committed Aug 15, 2009
1 parent 20794f8 commit 9495303
Showing 1 changed file with 44 additions and 0 deletions.
@@ -0,0 +1,44 @@
package org.jumpmind.symmetric.common.logging;

import java.util.Locale;

import org.junit.Assert;
import org.junit.Test;

public class LogTest {

private Log logger = LogFactory.getLog(this.getClass());

@Test
public void getBasicMessages() {
logger.setLocale(new Locale("en_US"));
long l = 4l;
String s = logger.getMessage("BatchCompleting");
Assert.assertEquals("Completing batch null", s);
s = logger.getMessage("BatchCompleting", l);
Assert.assertEquals("Completing batch 4", s);

}

@Test
public void getSpanishMessages() {
logger.setLocale(new Locale("es"));
long l = 4l;
String s = logger.getMessage("BatchCompleting");
Assert.assertEquals("Realizaci—n de la hornada null", s);
s = logger.getMessage("BatchCompleting", l);
Assert.assertEquals("Realizaci—n de la hornada 4", s);
}

@Test
public void getBadLanguageMessages() {
Locale.setDefault(new Locale("en_US"));
logger.setLocale(new Locale("zz"));
long l = 4l;
String s = logger.getMessage("BatchCompleting");
Assert.assertEquals("Completing batch null", s);
s = logger.getMessage("BatchCompleting", l);
Assert.assertEquals("Completing batch 4", s);

}
}

0 comments on commit 9495303

Please sign in to comment.