| 
26 | 26 | import java.io.PrintStream;  | 
27 | 27 | import java.util.Arrays;  | 
28 | 28 | import java.util.List;  | 
 | 29 | +import java.util.Optional;  | 
29 | 30 | 
 
  | 
30 | 31 | /**  | 
31 |  | - * Unit tests for {@link Analyze}.  | 
 | 32 | + * Unit tests for {@link TranslateText}.  | 
32 | 33 |  */  | 
33 | 34 | @RunWith(JUnit4.class)  | 
34 | 35 | public class TranslateTextTest {  | 
@@ -56,7 +57,39 @@ public class TranslateTextTest {  | 
56 | 57 |     PrintStream out = new PrintStream(bout);  | 
57 | 58 | 
 
  | 
58 | 59 |     // Act  | 
59 |  | -    TranslateText.displaySupportedLanguages(out);  | 
 | 60 | +    TranslateText.displaySupportedLanguages(out, Optional.empty());  | 
 | 61 | + | 
 | 62 | +    // Assert  | 
 | 63 | +    String got = bout.toString();  | 
 | 64 | +    for (String language : languages) {  | 
 | 65 | +      assertThat(got).contains(language);  | 
 | 66 | +    }  | 
 | 67 | +  }  | 
 | 68 | + | 
 | 69 | +  @Test public void testSupportedLanguagesTargetFrench() throws Exception {  | 
 | 70 | +    //Supported languages  | 
 | 71 | +    List<String> languages = Arrays.asList(  | 
 | 72 | +        "Afrikaans", "Albanais", "Allemand", "Amharique", "Anglais", "Arabe", "Arménien",  | 
 | 73 | +        "Azéri", "Basque", "Bengali", "Biélorusse", "Birman", "Bosniaque", "Bulgare", "Catalan",  | 
 | 74 | +        "Cebuano", "Chichewa", "Chinois (simplifié)", "Chinois (traditionnel)", "Cingalais",  | 
 | 75 | +        "Coréen", "Corse", "Créole haïtien", "Croate", "Danois", "Espagnol", "Espéranto",  | 
 | 76 | +        "Estonien", "Finnois", "Français", "Frison", "Gaélique (Écosse)", "Galicien",  | 
 | 77 | +        "Gallois", "Géorgien", "Grec", "Gujarati", "Haoussa", "Hawaïen", "Hébreu", "Hindi",  | 
 | 78 | +        "Hmong", "Hongrois", "Igbo", "Indonésien", "Irlandais", "Islandais", "Italien",  | 
 | 79 | +        "Japonais", "Javanais", "Kannada", "Kazakh", "Khmer", "Kirghiz", "Kurde", "Laotien",  | 
 | 80 | +        "Latin", "Letton", "Lituanien", "Luxembourgeois", "Macédonien", "Malaisien", "Malayalam",  | 
 | 81 | +        "Malgache", "Maltais", "Maori", "Marathi", "Mongol", "Néerlandais", "Népalais", "Norvégien",  | 
 | 82 | +        "Ouzbek", "Pachtô", "Panjabi", "Persan", "Polonais", "Portugais", "Roumain", "Russe",  | 
 | 83 | +        "Samoan", "Serbe", "Sesotho", "Shona", "Sindhî", "Slovaque", "Slovène", "Somali",  | 
 | 84 | +        "Soundanais", "Suédois", "Swahili", "Tadjik", "Tagalog", "Tamoul", "Tchèque", "Telugu",  | 
 | 85 | +        "Thaï", "Turc", "Ukrainien", "Urdu", "Vietnamien", "Xhosa", "Yiddish", "Yorouba","Zoulou");   | 
 | 86 | +    | 
 | 87 | +    // Arrange  | 
 | 88 | +    ByteArrayOutputStream bout = new ByteArrayOutputStream();  | 
 | 89 | +    PrintStream out = new PrintStream(bout);  | 
 | 90 | + | 
 | 91 | +    // Act  | 
 | 92 | +    TranslateText.displaySupportedLanguages(out, Optional.of("fr"));  | 
60 | 93 | 
 
  | 
61 | 94 |     // Assert  | 
62 | 95 |     String got = bout.toString();  | 
 | 
0 commit comments