示例#1
0
文件: DictTest.java 项目: Hronom/AIF2
  @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
文件: DictTest.java 项目: Hronom/AIF2
  @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
文件: DictTest.java 项目: Hronom/AIF2
  @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);
  }