HaikuReview { public boolean isHaiku(String input) { if (!validateLineCount(input)) { return false; } String[] lines = asLines(input); if (countSyllables(lines[0]) != FIRST_LINE_SYLLABLE_COUNT) { return false; } if (countSyllables(lines[1]) != SECOND_LINE_SYLLABLE_COUNT) { return false; } if (countSyllables(lines[2]) != THIRD_LINE_SYLLABLE_COUNT) { return false; } return true; }  boolean validateLineCount(String input); int countWords(String input); String[] asLines(String input); int countSyllables(String input); boolean isHaiku(String input); String review(String input); static final int FIRST_LINE_SYLLABLE_COUNT; static final int SECOND_LINE_SYLLABLE_COUNT; static final int THIRD_LINE_SYLLABLE_COUNT; static final String RESULT_VALID; static final String RESULT_SEPARATOR; static final String RESULT_NO; }
@Test public void testWellFormedInputIsHaiku() { boolean isHaiku = haikuReview.isHaiku(VALID_INPUT_ONE); assertThat(isHaiku).isTrue(); }
@Test public void testIncorrectNumberOfSyllablesInFirstLineIsNotHaiku() throws Exception { boolean isHaiku = haikuReview.isHaiku(INVALID_FIRST_LINE); assertThat(isHaiku).isFalse(); }
@Test public void testIncorrectNumberOfSyllablesInSecondLineInNotHaiku() throws Exception { boolean isHaiku = haikuReview.isHaiku(INVALID_SECOND_LINE); assertThat(isHaiku).isFalse(); }
@Test public void testIncorrectNumberOfSyllablesInThirdLineInNotHaiku() throws Exception { boolean isHaiku = haikuReview.isHaiku(INVALID_THIRD_LINE); assertThat(isHaiku).isFalse(); }