UI-Lion: set up framework for Italian BundleStitcherTest.
Change-Id: I4c995c4e1221cda874cb5feb139de689a8258273
diff --git a/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java b/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java
index a362deb..f1a606a 100644
--- a/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java
@@ -17,10 +17,16 @@
package org.onosproject.ui.lion.stitch;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.onosproject.ui.AbstractUiTest;
import org.onosproject.ui.lion.LionBundle;
+import java.util.Locale;
+
import static org.junit.Assert.assertEquals;
/**
@@ -32,42 +38,45 @@
"/org/onosproject/ui/lion/stitchtests";
private static final String[] CARD_GAME_1_KEYS = {
- "of",
- "flush",
- "full_house",
- "pair",
- "three_oak",
-
- "ace",
- "king",
- "queen",
- "jack",
- "ten",
-
- "spades",
- "clubs",
+ "of", "flush", "full_house", "pair", "three_oak",
+ "ace", "king", "queen", "jack", "ten",
+ "spades", "clubs",
};
private static final String[] CARD_GAME_1_ENGLISH = {
- "of",
- "Flush",
- "Full House",
- "Pair",
- "Three of a Kind",
-
- "Ace",
- "King",
- "Queen",
- "Jack",
- "Ten",
-
- "Spades",
- "Clubs",
+ "of", "Flush", "Full House", "Pair", "Three of a Kind",
+ "Ace", "King", "Queen", "Jack", "Ten",
+ "Spades", "Clubs",
};
+ // TODO: Andrea to Localize to Italian
+ private static final String[] CARD_GAME_1_ITALIAN = {
+ "of", "Flush", "Full House", "Pair", "Three of a Kind",
+ "Ace", "King", "Queen", "Jack", "Ten",
+ "Spades", "Clubs",
+ };
+
+ private static Locale systemLocale;
private LionBundle lion;
+ @BeforeClass
+ public static void classSetup() {
+ systemLocale = Locale.getDefault();
+ }
+
+ @AfterClass
+ public static void classTeardown() {
+ Locale.setDefault(systemLocale);
+ }
+
+ @Before
+ public void testSetup() {
+ // reset to a known default locale before starting each test
+ Locale.setDefault(Locale.US);
+ }
+
+
private BundleStitcher testStitcher() {
return new BundleStitcher(TEST_RESOURCE_BASE);
}
@@ -85,10 +94,34 @@
@Test
public void cardGame1English() {
title("cardGame1English");
+ // use default locale (en_US)
+
lion = testStitcher().stitch("CardGame1");
print(lion);
assertEquals("wrong key", "CardGame1", lion.id());
assertEquals("bad key count", 12, lion.size());
verifyItems(lion, CARD_GAME_1_ENGLISH);
}
+
+ /*
+ * TODO: Andrea to localize
+ * Under: ${ONOS_ROOT}/core/api/src/test/resources/
+ *
+ * Bundles to Localize:
+ * org/onosproject/ui/lion/stitchtests/app/Cards.properties
+ * org/onosproject/ui/lion/stitchtests/core/stuff/Rank.properties
+ * org/onosproject/ui/lion/stitchtests/core/stuff/Suit.properties
+ */
+ @Ignore("Andrea to localize bundles to Italian")
+ @Test
+ public void cardGame1Italian() {
+ title("cardGame1Italian");
+ Locale.setDefault(Locale.ITALIAN);
+
+ lion = testStitcher().stitch("CardGame1");
+ print(lion);
+ assertEquals("wrong key", "CardGame1", lion.id());
+ assertEquals("bad key count", 12, lion.size());
+ verifyItems(lion, CARD_GAME_1_ITALIAN);
+ }
}