<commit_before>package org.tendiwa.lexeme;

import com.google.common.collect.ImmutableSet;
import java.util.stream.IntStream;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.tendiwa.lexeme.implementations.English;

/**
 * @since 0.1
 */
public final class ParsedLexemeTest {
    @Test
    public void hasBaseForm() throws Exception {
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .baseForm(),
            CoreMatchers.equalTo("bear")
        );
    }


    @Test
    public void worksWithZeroPersistentGrammemes() throws Exception {
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .persistentGrammemes(),
            CoreMatchers.equalTo(ImmutableSet.of())
        );
    }

    @Test
    public void canAssumeCorrectForm() throws Exception {
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .form(ImmutableSet.of(English.Grammemes.Plur)),
            CoreMatchers.equalTo("bears")
        );
    }

    @Test
    public void canBeUsedMultipleTimes() throws Exception {
        final ParsedLexeme lexeme =
            this.firstWordOfBundle("characters.en_US.words");
        IntStream.range(0, 1).forEach(
            i->
                MatcherAssert.assertThat(
                    lexeme.baseForm(),
                    CoreMatchers.equalTo("bear")
                )
        );
    }<commit_msg>#61 Use Placeholder in test for ParsedLexeme<commit_after>package org.tendiwa.lexeme;

import com.google.common.collect.ImmutableSet;
import java.util.stream.IntStream;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.mockito.Mockito;
import org.tendiwa.lexeme.implementations.English;

/**
 * @since 0.1
 */
public final class ParsedLexemeTest {
    @Test
    public void hasBaseForm() throws Exception {
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .baseForm(),
            CoreMatchers.equalTo("bear")
        );
    }


    @Test
    public void worksWithZeroPersistentGrammemes() throws Exception {
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .persistentGrammemes(),
            CoreMatchers.equalTo(ImmutableSet.of())
        );
    }

    @Test
    public void canAssumeCorrectForm() throws Exception {
        Placeholder placeholder = Mockito.mock(Placeholder.class);
        Mockito.when(placeholder.grammaticalMeaning())
            .thenReturn(ImmutableSet.of(English.Grammemes.Plur));
        MatcherAssert.assertThat(
            this
                .firstWordOfBundle("characters.en_US.words")
                .formForPlaceholder(placeholder),
            CoreMatchers.equalTo("bears")
        );
    }

    @Test
    public void canBeUsedMultipleTimes() throws Exception {
        final ParsedLexeme lexeme =
            this.firstWordOfBundle("characters.en_US.words");
        IntStream.range(0, 1).forEach(
            i->
                MatcherAssert.assertThat(
                    lexeme.baseForm(),
                    CoreMatchers.equalTo("bear")
                )
        );
    }
{'fraction_non_alphanumeric': 0.09640666082383874, 'fraction_numerical': 0.00292141396435875, 'mean_word_length': 2.079136690647482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '252089', 'n_tokens_mistral': 1002, 'n_tokens_neox': 944, 'n_words': 151}