@Test public void testEmpty() { assertThrows(VocabHunterException.class, () -> InitialSelectionTool.nextWord(words())); }
public static WordModel nextWord(final List<WordModel> words) { if (words == null || words.isEmpty()) { throw new VocabHunterException("Empty word list"); } else { int lastSeen = getLastSeenIndex(words); int result = lastSeen + 1; if (result == words.size()) { --result; } return words.get(result); } }
InitialSelectionTool { public static WordModel nextWord(final List<WordModel> words) { if (words == null || words.isEmpty()) { throw new VocabHunterException("Empty word list"); } else { int lastSeen = getLastSeenIndex(words); int result = lastSeen + 1; if (result == words.size()) { --result; } return words.get(result); } } }
InitialSelectionTool { public static WordModel nextWord(final List<WordModel> words) { if (words == null || words.isEmpty()) { throw new VocabHunterException("Empty word list"); } else { int lastSeen = getLastSeenIndex(words); int result = lastSeen + 1; if (result == words.size()) { --result; } return words.get(result); } } private  InitialSelectionTool(); }
InitialSelectionTool { public static WordModel nextWord(final List<WordModel> words) { if (words == null || words.isEmpty()) { throw new VocabHunterException("Empty word list"); } else { int lastSeen = getLastSeenIndex(words); int result = lastSeen + 1; if (result == words.size()) { --result; } return words.get(result); } } private  InitialSelectionTool(); static WordModel nextWord(final List<WordModel> words); }
InitialSelectionTool { public static WordModel nextWord(final List<WordModel> words) { if (words == null || words.isEmpty()) { throw new VocabHunterException("Empty word list"); } else { int lastSeen = getLastSeenIndex(words); int result = lastSeen + 1; if (result == words.size()) { --result; } return words.get(result); } } private  InitialSelectionTool(); static WordModel nextWord(final List<WordModel> words);  }