/**
   * Test method for {@link edu.ltu.stringreporter.StringReporter#getWordFrequency(java.lang.String,
   * java.lang.String)} .
   *
   * @throws IOException
   */
  @Test
  public void testGetWordFrequency() throws IOException {
    String teststring = "Hello Kiran! Hello Jonhny. Hello, Gordon. Is that 'hello' to everyone?";
    String s = "hello kiran hello jonhny hello gordon is that hello to everyone";

    String[] each = s.split(" "); // Splitting the string by spaces
    int cnt = 0; // counter
    String kWord = "hello"; // place the unique word that needs to know the
    // frequency of that word
    for (int i = 0; i < each.length; i++) {
      if (each[i].equalsIgnoreCase(kWord)) {
        cnt++;
      }
    }
    AssertJUnit.assertEquals(cnt, StringReporter.getWordFrequency(s, kWord));

    // Additional tests
    AssertJUnit.assertEquals(0, StringReporter.getWordFrequency(teststring, "test"));
    AssertJUnit.assertEquals(1, StringReporter.getWordFrequency(teststring, "kiran"));
    AssertJUnit.assertEquals(0, StringReporter.getWordFrequency(teststring, "johnny"));
    AssertJUnit.assertEquals(1, StringReporter.getWordFrequency(teststring, "jonhny"));
    AssertJUnit.assertEquals(1, StringReporter.getWordFrequency(teststring, "gordon"));
    AssertJUnit.assertEquals(1, StringReporter.getWordFrequency(teststring, "everyone"));
  }