SpelledWord { public boolean isComplete() { for (int i = 0; i < letters.size(); ++i) { SpelledLetter spelledLetter = letters.get(i); if (spelledLetter == null || !spelledLetter.isComplete()) { return false; } } return true; }  boolean isComplete(); public Long _id; public List<SpelledLetter> letters; }
@Test public void singleSources() { SpelledWord word = new SpelledWord(); word.letters = Arrays.asList( TestUtil.createSpelledLetter("O", "O"), TestUtil.createSpelledLetter("K", "K")); assertTrue(word.isComplete()); }
@Test public void singleAndMultiSource() { SpelledWord word = new SpelledWord(); word.letters = Arrays.asList( TestUtil.createSpelledLetter("O", "O"), TestUtil.createSpelledLetter("K", "A", "B", "C", "D")); assertTrue(word.isComplete()); }
@Test public void multiSources() { SpelledWord word = new SpelledWord(); word.letters = Arrays.asList( TestUtil.createSpelledLetter("O", "W", "X", "Y", "Z"), TestUtil.createSpelledLetter("K", "A", "B", "C", "D")); assertTrue(word.isComplete()); }
@Test public void incomplete() { SpelledWord word = new SpelledWord(); word.letters = Arrays.asList( TestUtil.createSpelledLetter("O", "O"), TestUtil.createSpelledLetter("K", "A")); assertFalse(word.isComplete()); }