@Test(groups = "unit-tests", enabled = false) public void getWords() throws Exception { Set<IWord> words = fixture .entrySet() .stream() .map( pair -> new Word( pair.getKey(), new HashSet<String>(pair.getValue()), (long) pair.getValue().size())) .collect(Collectors.toSet()); IDict dict = Dict.create(words); assertEquals(dict.getWords(), words); }
@Test(groups = "unit-tests", enabled = false) public void testSearchNoResults() throws Exception { Set<IWord> words = fixture .entrySet() .stream() .map( pair -> new Word( pair.getKey(), new HashSet<String>(pair.getValue()), (long) pair.getValue().size())) .collect(Collectors.toSet()); ISearchable dict = Dict.create(words); Optional actual = dict.search("bingo"); assertFalse(actual.isPresent()); }
@Test(groups = "unit-tests", enabled = false) public void testSearch() throws Exception { IWord expectedIWord = new Word("see", fixture.remove("see"), 0l); Set<IWord> words = fixture .entrySet() .stream() .map( pair -> new Word( pair.getKey(), new HashSet<String>(pair.getValue()), (long) pair.getValue().size())) .collect(Collectors.toSet()); words.add(expectedIWord); ISearchable dict = Dict.create(words); Optional actual = dict.search("foreseen"); assertEquals(actual.get(), expectedIWord); }