@@ -0,0 +1,2991 @@
+package net.openhft.chronicle.map;%0A%0Aimport net.openhft.chronicle.hash.Value;%0Aimport org.jetbrains.annotations.NotNull;%0Aimport org.junit.Test;%0A%0Aimport java.util.Iterator;%0Aimport java.util.Map;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0A%0Apublic class ListenersTest %7B%0A    %0A    static class CountingEntryOperations%3CK, V%3E implements MapEntryOperations%3CK, V, Void%3E %7B%0A        AtomicInteger removeCount = new AtomicInteger();%0A        AtomicInteger insertCount = new AtomicInteger();%0A        AtomicInteger replaceValueCount = new AtomicInteger();%0A        @Override%0A        public Void remove(@NotNull MapEntry%3CK, V%3E entry) %7B%0A            removeCount.incrementAndGet();%0A            return MapEntryOperations.super.remove(entry);%0A        %7D%0A        @Override%0A        public Void replaceValue(@NotNull MapEntry%3CK, V%3E entry, Value%3CV, ?%3E newValue) %7B%0A            replaceValueCount.incrementAndGet();%0A            return MapEntryOperations.super.replaceValue(entry, newValue);%0A        %7D%0A%0A        @Override%0A        public Void insert(@NotNull MapAbsentEntry%3CK, V%3E absentEntry, Value%3CV, ?%3E value) %7B%0A            insertCount.incrementAndGet();%0A            return MapEntryOperations.super.insert(absentEntry, value);%0A        %7D%0A    %7D%0A    %0A    @Test%0A    public void testRemove() %7B%0A        CountingEntryOperations%3CInteger, Integer%3E removeCounting =%0A                new CountingEntryOperations%3C%3E();%0A        ChronicleMap%3CInteger, Integer%3E map =%0A                ChronicleMapBuilder.of(Integer.class, Integer.class)%0A                .entries(100)%0A                .entryOperations(removeCounting)%0A                .create();%0A        %0A        map.put(1, 1);%0A        map.remove(1); // removeCount 1%0A        %0A        map.put(1, 1);%0A        assertFalse(map.remove(1, 2));%0A        map.remove(1, 1); // removeCount 2%0A        %0A        map.put(1, 1);%0A        map.merge(1, 1, (v1, v2) -%3E null); // removeCount 3%0A        %0A        map.put(1, 1);%0A        Iterator%3CMap.Entry%3CInteger, Integer%3E%3E it = map.entrySet().iterator();%0A        it.next();%0A        it.remove(); // removeCount 4%0A%0A        assertEquals(4, removeCounting.removeCount.get());%0A    %7D%0A%0A    @Test%0A    public void testPut() %7B%0A        CountingEntryOperations%3CInteger, Integer%3E putCounting =%0A                new CountingEntryOperations%3C%3E();%0A        ChronicleMap%3CInteger, Integer%3E map =%0A                ChronicleMapBuilder.of(Integer.class, Integer.class)%0A                        .entries(100)%0A                        .entryOperations(putCounting)%0A                        .create();%0A%0A        map.put(1, 1); // insert 1%0A%0A        map.put(1, 2); // replaceValue 1%0A        map.compute(1, (k, v) -%3E 2); // replaceValue 2%0A        %0A        map.entrySet().iterator().next().setValue(1); // replaceValue 3%0A        %0A        map.compute(2, (k, v) -%3E 1); // insert 2%0A%0A        assertEquals(3, putCounting.replaceValueCount.get());%0A        assertEquals(2, putCounting.insertCount.get());%0A    %7D%0A%7D%0A

Add Listeners test