HaikuReview { int numberOfSyllables(String input) { int count = 0; char[] chars = input.toCharArray(); for (int i = 0; i < chars.length; i++) { if (i == chars.length - 1 && isVowel(chars[i])) { return count + 1; } if (isVowel(chars[i]) && !isVowel(chars[i + 1])) { count++; } } return count; }  boolean isHaiku(String input); static final String INPUT_ONE; static final String INPUT_TWO; }
@Test public void givenAWordOfTwoNonConsequtiveVowels_ThenAnswerIs2() throws Exception { String input = "code"; int i = haikuReview.numberOfSyllables(input); assertThat(i).isEqualTo(2); }
@Test public void givenAWordWithTwoConsecutiveVowels_ThenAnsweris1() throws Exception { String input = "Good"; int i = haikuReview.numberOfSyllables(input); assertThat(i).isEqualTo(1); }
@Test public void givenAHaikuLineWithThreeWords_ThenAnswerIs5() { String input = "happy purple frog"; int i = haikuReview.numberOfSyllables(input); assertThat(i).isEqualTo(5); }