<commit_before>package org.nohope.bean;

import org.junit.Test;

import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @since 12/10/12 3:28 PM
 */
public class StatefulDispatcherTest {

    @Test
    public void naiveTest() {
        final Dispatcher dispatcher = new Dispatcher();
        final SimpleBean a = new SimpleBean(dispatcher);
        final SimpleBean b = new SimpleBean(dispatcher);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        a.setA(1);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        b.setA(1);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        a.setA(1);
        assertTrue(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        b.setA(1);
        assertTrue(dispatcher.heated(a));
        assertTrue(dispatcher.heated(b));
    }

    private static class SimpleBean extends AbstractDispatchable<SimpleBean> {
        protected SimpleBean(@Nonnull final IDispatcher<SimpleBean> dispatcher) {
            super(dispatcher);
        }

        @Dispatch
        public void setA(final int param) {
        }
    }

    private static class Dispatcher extends StatefulDispatcher {
        private final Map<Object, Boolean> heated = new HashMap<>();

        @Override
        protected void handle(@Nonnull final IDispatchable obj
                , @Nonnull final String propertyName
                , final Object oldValue
                , final Object newValue
                , final boolean previousExists) {
            if (previousExists) {
                heated.put(obj, true);
            }
        }

        public boolean heated(final Object bean) {
            return heated.containsKey(bean);
        }
    }
}<commit_msg>javadoc/tests warnings fix<commit_after>package org.nohope.bean;

import org.junit.Test;

import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @since 12/10/12 3:28 PM
 */
public class StatefulDispatcherTest {

    @Test
    public void naiveTest() {
        final Dispatcher dispatcher = new Dispatcher();
        final SimpleBean a = new SimpleBean(dispatcher);
        final SimpleBean b = new SimpleBean(dispatcher);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        a.setA(1);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        b.setA(1);
        assertFalse(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        a.setA(1);
        assertTrue(dispatcher.heated(a));
        assertFalse(dispatcher.heated(b));
        b.setA(1);
        assertTrue(dispatcher.heated(a));
        assertTrue(dispatcher.heated(b));
    }

    private static class SimpleBean extends AbstractDispatchable<SimpleBean> {
        protected SimpleBean(@Nonnull final IDispatcher<SimpleBean> dispatcher) {
            super(dispatcher);
        }

        @Dispatch
        public void setA(final int param) {
        }
    }

    private static class Dispatcher extends StatefulDispatcher<SimpleBean> {
        private final Map<Object, Boolean> heated = new HashMap<>();

        @Override
        protected void handle(@Nonnull final SimpleBean obj
                , @Nonnull final String propertyName
                , final Object oldValue
                , final Object newValue
                , final boolean previousExists) {
            if (previousExists) {
                heated.put(obj, true);
            }
        }

        public boolean heated(final Object bean) {
            return heated.containsKey(bean);
        }
    }
}
{'fraction_non_alphanumeric': 0.10321446509291814, 'fraction_numerical': 0.0065293822199899544, 'mean_word_length': 2.4218213058419242, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5715576', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1074, 'n_words': 244}