Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at Symmetric Logger with internationalization.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
symmetric/src/test/java/org/jumpmind/symmetric/common/logging/LogTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
||
} | ||
} |