### Question:
FrequencyFileLoader { public List<WordFrequency> load(final File file) throws IOException { return load(new FileInputStream(file)); }  List<WordFrequency> load(final File file); List<WordFrequency> load(final InputStream inputStream); static final String DEFAULT_ENCODING; }### Answer:
@Test(expected = KumoException.class) public void malformedWordCount() throws IOException { FREQUENCY_FILE_LOADER.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("frequency_file_malformed_word_count.txt")); }
@Test public void basic() throws IOException { final List<WordFrequency> wordFrequencies = FREQUENCY_FILE_LOADER.load(IOUtils.toInputStream( "100:cat\n" + "50:dog\n" + "25:fish\n" + "75:frog")); assertEquals(4, wordFrequencies.size()); assertEquals(100, wordFrequencies.get(0).getFrequency()); assertEquals("cat", wordFrequencies.get(0).getWord()); assertEquals(75, wordFrequencies.get(1).getFrequency()); assertEquals("frog", wordFrequencies.get(1).getWord()); assertEquals(50, wordFrequencies.get(2).getFrequency()); assertEquals("dog", wordFrequencies.get(2).getWord()); assertEquals(25, wordFrequencies.get(3).getFrequency()); assertEquals("fish", wordFrequencies.get(3).getWord()); }
@Test public void validFile() throws IOException { final List<WordFrequency> wordFrequencies = FREQUENCY_FILE_LOADER.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("frequency_file.txt")); assertEquals(4, wordFrequencies.size()); assertEquals(100, wordFrequencies.get(0).getFrequency()); assertEquals("cat", wordFrequencies.get(0).getWord()); assertEquals(75, wordFrequencies.get(1).getFrequency()); assertEquals("frog", wordFrequencies.get(1).getWord()); assertEquals(50, wordFrequencies.get(2).getFrequency()); assertEquals("dog", wordFrequencies.get(2).getWord()); assertEquals(25, wordFrequencies.get(3).getFrequency()); assertEquals("fish", wordFrequencies.get(3).getWord()); }
@Test(expected = KumoException.class) public void malformedWord() throws IOException { FREQUENCY_FILE_LOADER.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("frequency_file_malformed_word.txt")); }