Пример #1
0
  @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);
  }
Пример #2
0
  @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());
  }
Пример #3
0
  @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);
  }