/[schmitzm]/trunk/src_junit/skrueger/i8n/I8NUtilTest.java
ViewVC logotype

Contents of /trunk/src_junit/skrueger/i8n/I8NUtilTest.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1107 - (show annotations)
Thu Oct 14 10:39:07 2010 UTC (14 years, 4 months ago) by alfonx
File MIME type: text/plain
File size: 1543 byte(s)
tests fixed
1 package skrueger.i8n;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertTrue;
6
7 import java.util.ArrayList;
8 import java.util.List;
9 import java.util.Locale;
10
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13
14 public class I8NUtilTest {
15
16 final static String oneLineCoded = "de{Baum}en{tree}";
17 final static List<String> langs4 = new ArrayList<String>();
18
19 @BeforeClass
20 public static void setup() {
21 langs4.add("de");
22 langs4.add("en");
23 langs4.add("xx");
24 langs4.add("yy");
25 }
26
27 @Test
28 public void testCreateFromOneLine() {
29 Translation t = I8NUtil.createFromOneLine(oneLineCoded);
30 assertEquals("Baum", t.toString("de"));
31 assertEquals("tree", t.toString("en"));
32 assertEquals(oneLineCoded, t.toOneLine());
33 }
34
35 @Test
36 public void testIsValidISOLangCode() {
37 assertTrue(I8NUtil.isValidISOLangCode("de"));
38 assertTrue(I8NUtil.isValidISOLangCode("ar"));
39 assertFalse(I8NUtil.isValidISOLangCode("äü"));
40 assertFalse(I8NUtil.isValidISOLangCode("ara"));
41 }
42
43 @Test
44 public void testMitUmlaute() {
45 assertEquals("öäü", I8NUtil.mitUmlaute("oeaeue"));
46 }
47
48 @Test
49 public void testQmTranslation() {
50 Translation t = I8NUtil.createFromOneLine(oneLineCoded);
51 assertEquals(0.5, I8NUtil.qmTranslation(langs4, t), .00000000001);
52 }
53
54 @Test
55 public void testGetLocalesForLang() {
56 List<Locale> locales = I8NUtil.getLocalesForLang("en");
57
58 assertTrue(locales.contains(new Locale("en", "za")));
59 assertTrue(locales.contains(new Locale("en", "sg")));
60 }
61
62 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26