HaikuReview { public static int getNumberOfSyllables(String input) { int count = 0; boolean vowelFound = false; for (char c : input.toCharArray()) { if (!vowelFound && isVowel(String.valueOf(c))) { count++; vowelFound = true; } else { vowelFound = false; } } return count; }  static String processHaiku(String haiku); static int getNumberOfLines(String input); static int getNumberOfSyllables(String input); static boolean isSyllable(String input); static boolean isVowel(String s);  }
@Test public void testIndigestionHasFourSyllables() throws Exception { String input = "indigestion"; int count = HaikuReview.getNumberOfSyllables(input); assertThat(count).isEqualTo(4); }
@Test public void testCountIsSevenForValidInputWithContinuousSyllables() throws Exception { String input = "get indigestion"; int count = HaikuReview.getNumberOfSyllables(input); assertThat(count).isEqualTo(5); }
@Test public void testValidNumberOfSyllablesForHaiku() throws Exception { String haiku = "happy purple frog/eating bugs in the marshes/get indigestion"; int numberOfSyllables = HaikuReview.getNumberOfSyllables(haiku); assertThat(numberOfSyllables).isEqualTo(17); }
@Test public void testCountIsFiveForValidInput() throws Exception { String input = "happy purple frog"; int count = HaikuReview.getNumberOfSyllables(input); assertThat(count).isEqualTo(5); }
@Test public void testCountIsSevenForValidInput() throws Exception { String input = "eating bugs in the marshes"; int count = HaikuReview.getNumberOfSyllables(input); assertThat(count).isEqualTo(7); }