HaikuReview { public static boolean checkWordsInEachLine(String haiku) { if (!hasThreeLines(haiku)) return false; String[] arrayResult = haiku.split("/"); for (String sentence : arrayResult) { String[] words = sentence.split(" "); if (words.length == 0) { return false; } for (String word : words) { if (!hasWord(word)) return false; } } return true; }  static boolean hasThreeLines(String input); static boolean hasWord(String input); static boolean checkWordsInEachLine(String haiku);  }
@Test public void testCheckWordInEachLinePasses(){ String text ="word/word/word word"; assertThat( HaikuReview.checkWordsInEachLine(text)) .isEqualTo(true); }
@Test public void testCheckWordInEachLineFails(){ String text ="one/ /three"; assertThat( HaikuReview.checkWordsInEachLine(text)) .isEqualTo(false); }