Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Dec 15, 2015
1 parent ba454b3 commit 24da267
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions src/test/java/net/sf/jabref/logic/l10n/LocalizationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,56 @@ public class LocalizationTest {

@Test
public void testSetKnownLanguage() {
Locale.setDefault(Locale.CHINA);
Localization.setLanguage("en");
assertEquals("en", Locale.getDefault().toString());
Locale before = Locale.getDefault();

try {
Locale.setDefault(Locale.CHINA);
Localization.setLanguage("en");
assertEquals("en", Locale.getDefault().toString());
} finally {
Locale.setDefault(before);
}
}

@Test
public void testSetUnknownLanguage() {
Locale.setDefault(Locale.CHINA);
Localization.setLanguage("WHATEVER");
assertEquals(Locale.CHINA.toString(), Locale.getDefault().toString());
Locale before = Locale.getDefault();

try {
Locale.setDefault(Locale.CHINA);
Localization.setLanguage("WHATEVER");
assertEquals(Locale.CHINA.toString(), Locale.getDefault().toString());
} finally {
Locale.setDefault(before);
}
}

@Test
public void testKnownTranslation() {
Localization.setLanguage("en");
String knownKey = "Groups";
assertEquals(knownKey, Localization.lang(knownKey));
assertEquals(knownKey, Localization.menuTitle(knownKey));
Locale before = Locale.getDefault();

try {
Localization.setLanguage("en");
String knownKey = "Groups";
assertEquals(knownKey, Localization.lang(knownKey));
assertEquals(knownKey, Localization.menuTitle(knownKey));
} finally {
Locale.setDefault(before);
}
}

@Test
public void testUnknownTranslation() {
Localization.setLanguage("en");
String knownKey = "WHATEVER";
assertEquals(knownKey, Localization.lang(knownKey));
assertEquals(knownKey, Localization.menuTitle(knownKey));
Locale before = Locale.getDefault();

try {
Localization.setLanguage("en");
String knownKey = "WHATEVER";
assertEquals(knownKey, Localization.lang(knownKey));
assertEquals(knownKey, Localization.menuTitle(knownKey));
} finally {
Locale.setDefault(before);
}
}

}

0 comments on commit 24da267

Please sign in to comment.