<commit_before>package org.tenidwa.collections.utils;

import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
 * Unit tests for {@link ContentMap}.
 * @author <NAME> (<EMAIL>)
 * @version $Id$
 * @since 0.6.0
 */
public final class ContentMapTest {
    @Test
    public void detectsIdenticalValues() {
        final ContentMap<Dude, String, Integer> map = new ContentMap<>(
            Dude::name
        );
        map.put(new CombinedDude("je", "ff"), 2);
        MatcherAssert.assertThat(
            map.containsKey(new PlainDude("jeff")),
            Matchers.is(true)
        );
        MatcherAssert.assertThat(
            map.get(new PlainDude("jeff")),
            Matchers.equalTo(2)
        );
    }

    interface Dude {
        String name();
    }

    final static class PlainDude implements Dude {
        private final String name;

        PlainDude(final String name) {
            this.name = name;
        }

        @Override
        public String name() {
            return this.name;
        }
    }

    final static class CombinedDude implements Dude {
        private final String one;
        private final String two;

        @Override
        public String name() {
            return this.one + this.two;
        }

        CombinedDude(final String one, final String two) {
            this.one = one;
            this.two = two;
        }
    }
}
<commit_msg>#17 Rewrite test for ContentMap<commit_after>package org.tenidwa.collections.utils;

import com.google.common.collect.ImmutableMap;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
 * Unit tests for {@link ContentMap}.
 * @author <NAME> (<EMAIL>)
 * @version $Id$
 * @since 0.6.0
 */
public final class ContentMapTest {
    @Test
    public void detectsIdenticalValues() {
        final ContentMap<Dude, String, Integer> map = new ContentMap<>(
            ImmutableMap.of(
                new CombinedDude("je", "ff"),
                2
            ),
            Dude::name
        );
        MatcherAssert.assertThat(
            map.containsKey(new PlainDude("jeff")),
            Matchers.is(true)
        );
        MatcherAssert.assertThat(
            map.get(new PlainDude("jeff")),
            Matchers.equalTo(2)
        );
    }

    private interface Dude {
        String name();
    }

    private final static class PlainDude implements Dude {
        private final String name;

        PlainDude(final String name) {
            this.name = name;
        }

        @Override
        public String name() {
            return this.name;
        }
    }

    private final static class CombinedDude implements Dude {
        private final String one;
        private final String two;

        @Override
        public String name() {
            return this.one + this.two;
        }

        CombinedDude(final String one, final String two) {
            this.one = one;
            this.two = two;
        }
    }
}

{'fraction_non_alphanumeric': 0.10089611682708265, 'fraction_numerical': 0.003982741453700631, 'mean_word_length': 1.827392120075047, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4939337', 'n_tokens_mistral': 887, 'n_tokens_neox': 850, 'n_words': 218}