Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
fix: downcase translated text in Integration Test (#425)
Browse files Browse the repository at this point in the history
Downcase the translated text to match assertion value.
  • Loading branch information
Neenu1995 committed Feb 17, 2021
1 parent 1e7a558 commit b165906
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -32,6 +32,7 @@
import com.google.common.collect.ImmutableList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import org.junit.Test;

Expand Down Expand Up @@ -104,10 +105,10 @@ public void testDetectLanguageOfText() {
public void testTranslateTextList() {
List<Translation> translations = TRANSLATE.translate(ImmutableList.of("ocho", "acht"));
Translation translation = translations.get(0);
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("es", translation.getSourceLanguage());
translation = translations.get(1);
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("de", translation.getSourceLanguage());
}

Expand All @@ -116,19 +117,19 @@ public void testTranslateTextListWithModel() {
List<Translation> translations =
TRANSLATE.translate(ImmutableList.of("ocho", "acht"), TranslateOption.model("nmt"));
Translation translation = translations.get(0);
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("es", translation.getSourceLanguage());
assertEquals("nmt", translation.getModel());
translation = translations.get(1);
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("de", translation.getSourceLanguage());
assertEquals("nmt", translation.getModel());
}

@Test
public void testTranslateText() {
Translation translation = TRANSLATE.translate("ocho");
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("es", translation.getSourceLanguage());
}

Expand Down Expand Up @@ -159,7 +160,7 @@ public void testDefaultCredentialsOverridesDefaultApiKey() {
public void testTranslateTextWithApiKey() {
Translate translate = RemoteTranslateHelper.create().getOptions().getService();
Translation translation = translate.translate("ocho");
assertEquals("eight", translation.getTranslatedText());
assertEquals("eight", translation.getTranslatedText().toLowerCase(Locale.ENGLISH));
assertEquals("es", translation.getSourceLanguage());
}
}

0 comments on commit b165906

Please sign in to comment.