<commit_before>package io.github.sangsoonam.enumparser;

import org.junit.Test;

import java.util.function.Function;

import static org.assertj.core.api.Assertions.assertThat;

public class EnumParserTest {

    enum TestEnum { Bar, FOO_BAR }

    @Test
    public void testParseWhenDifferentCase() {
        assertThat(EnumParser.forClass(TestEnum.class).parse("Bar")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parse("BAR")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parse("bar")).isSameAs(TestEnum.Bar);
    }


    @Test
    public void testParseStrictWhenDifferentCase() {
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("Bar")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("BAR")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("bar")).isSameAs(TestEnum.Bar);
    }

    @Test
    public void testParseWhenNull() {
        assertThat(EnumParser.forClass(TestEnum.class).parse(null)).isNull();<commit_msg>Use guava Function to support java 1.7<commit_after>package io.github.sangsoonam.enumparser;

import com.google.common.base.Function;

import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

public class EnumParserTest {

    enum TestEnum { Bar, FOO_BAR }

    @Test
    public void testParseWhenDifferentCase() {
        assertThat(EnumParser.forClass(TestEnum.class).parse("Bar")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parse("BAR")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parse("bar")).isSameAs(TestEnum.Bar);
    }


    @Test
    public void testParseStrictWhenDifferentCase() {
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("Bar")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("BAR")).isSameAs(TestEnum.Bar);
        assertThat(EnumParser.forClass(TestEnum.class).parseStrict("bar")).isSameAs(TestEnum.Bar);
    }

    @Test
    public void testParseWhenNull() {
        assertThat(EnumParser.forClass(TestEnum.class).parse(null)).isNull();
{'fraction_non_alphanumeric': 0.13375508359692725, 'fraction_numerical': 0.0009037505648441031, 'mean_word_length': 4.691516709511568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6963455', 'n_tokens_mistral': 705, 'n_tokens_neox': 697, 'n_words': 75}