@Test public void loadTranslations_OnlyName() throws IOException { when(bufferedReaderMock.readLine()).thenReturn("DictionnaireTest"); IDictionary dictionary = dictionaryParser.loadTranslations(bufferedReaderMock); assertThat(dictionary.getName(), is(equalTo("DictionnaireTest"))); assertThat(dictionary.isEmpty(), is(equalTo(true))); }
@Test public void loadTranslations_containsTranslation() throws IOException { when(bufferedReaderMock.readLine()) .thenReturn("DictionnaireTest") .thenReturn("contre = against") .thenReturn(""); IDictionary dictionary = dictionaryParser.loadTranslations(bufferedReaderMock); assertThat(dictionary.getName(), is(equalTo("DictionnaireTest"))); assertThat(dictionary.getTranslation("contre"), hasItem("against")); assertThat(dictionary.isEmpty(), is(equalTo(false))); }
@Test(expected = IOException.class) public void loadTranslations_noName() throws IOException { when(bufferedReaderMock.readLine()).thenReturn("contre = against").thenReturn(""); IDictionary dictionary = dictionaryParser.loadTranslations(bufferedReaderMock); }