Added unit test for UTF-8 encoded properties (#2295)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp
2021-04-19 17:07:47 +02:00
committed by GitHub
parent c9cdf5d0e8
commit 4311b167f3
3 changed files with 14 additions and 4 deletions
@@ -52,7 +52,8 @@ public class TranslationProviderOSGiTest extends JavaOSGiTest {
private static final String HELLO_MULTIPLE_NAMES_EN = "Hello openHAB, Hello thing, Hello rule!";
private static final String HELLO_MULTIPLE_NAMES_FR = "Bonjour openHAB, Bonjour thing, Bonjour rule!";
private static final String BYE_DEFAULT = "Tschuess!";
private static final String BYE_DE = "Tschüß!";
private static final String BYE_EN = "Bye!";
TranslationProvider translationProvider;
@@ -110,9 +111,13 @@ public class TranslationProviderOSGiTest extends JavaOSGiTest {
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo("default")));
text = translationProvider.getText(bundle, KEY_BYE, "default", new Locale("de", "AT"));
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo(BYE_DE)));
text = translationProvider.getText(bundle, KEY_BYE, "default", Locale.ENGLISH);
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo(BYE_DEFAULT)));
assertThat(text, is(equalTo(BYE_EN)));
}
@Test
@@ -149,9 +154,13 @@ public class TranslationProviderOSGiTest extends JavaOSGiTest {
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo("default")));
text = translationProvider.getText(bundle, KEY_BYE, "default", new Locale("de", "AT"), (Object[]) null);
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo(BYE_DE)));
text = translationProvider.getText(bundle, KEY_BYE, "default", Locale.ENGLISH, (Object[]) null);
assertThat(text, is(notNullValue()));
assertThat(text, is(equalTo(BYE_DEFAULT)));
assertThat(text, is(equalTo(BYE_EN)));
}
@Test
@@ -1 +1 @@
BYE = Tschuess!
BYE = Bye!