@Override public String getPlanName() { return Strings.nullToEmpty(translator.getTranslation(locale, item.getPlanName())); }
@Override public String getPhaseName() { return Strings.nullToEmpty(translator.getTranslation(locale, item.getPhaseName())); }
@Test(groups = "fast") public void testMissingTranslation() { // If the translation is missing from the file, return the original text final String originalText = "missing translation"; assertEquals(translation.getTranslation(Locale.US, originalText), originalText); }
@Test(groups = "fast") public void testMissingFileAndText() { // If the file is missing, and the "English" translation is missing, return the original text final String originalText = "missing translation"; assertEquals(translation.getTranslation(Locale.CHINA, originalText), originalText); } }
@Test(groups = "fast") public void testExistingTranslation() { // If the translation exists, return the translation final String originalText = "shotgun-monthly"; assertEquals(translation.getTranslation(Locale.US, originalText), "Monthly shotgun plan"); }
@Test(groups = "fast") public void testMissingTranslationFileWithEnglishText() { // If the translation file doesn't exist, return the "English" translation final String originalText = "shotgun-monthly"; assertEquals(translation.getTranslation(Locale.CHINA, originalText), "Monthly shotgun plan"); }
@Test(groups = "fast") public void testInitialization() { final String shotgunMonthly = "shotgun-monthly"; final String shotgunAnnual = "shotgun-annual"; final String badText = "Bad text"; assertEquals(translation.getTranslation(Locale.US, shotgunMonthly), "Monthly shotgun plan"); assertEquals(translation.getTranslation(Locale.US, shotgunAnnual), "Annual shotgun plan"); assertEquals(translation.getTranslation(Locale.US, badText), badText); assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, shotgunMonthly), "Fusil de chasse mensuel"); assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, shotgunAnnual), "Fusil de chasse annuel"); assertEquals(translation.getTranslation(Locale.CANADA_FRENCH, badText), badText); assertEquals(translation.getTranslation(Locale.CHINA, shotgunMonthly), "Monthly shotgun plan"); assertEquals(translation.getTranslation(Locale.CHINA, shotgunAnnual), "Annual shotgun plan"); assertEquals(translation.getTranslation(Locale.CHINA, badText), badText); }