diff --git a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java index 6cfdd785b..465d7a5c0 100644 --- a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java @@ -29,8 +29,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; /** - * Extension of {@link AbstractMapTest} for exercising the - * {@link CompositeMap} implementation. + * Extension of {@link AbstractMapTest} for exercising the {@link CompositeMap} implementation. * * @param the key type. * @param the value type. @@ -69,7 +68,7 @@ public class CompositeMapTest extends AbstractIterableMapTest { public CompositeMap makeObject() { final CompositeMap map = new CompositeMap<>(); map.addComposited(new HashMap<>()); - map.setMutator( new EmptyMapMutator<>() ); + map.setMutator(new EmptyMapMutator<>()); return map; } @@ -101,29 +100,25 @@ public class CompositeMapTest extends AbstractIterableMapTest { @Test @SuppressWarnings("unchecked") public void testPut() { - final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator() { - private static final long serialVersionUID = 1L; - @Override - public V put(final CompositeMap map, final Map[] composited, final K key, - final V value) { - pass = true; - return (V) "foo"; - } + final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator() { + private static final long serialVersionUID = 1L; - @Override - public void putAll(final CompositeMap map, final Map[] composited, final Map t) { - throw new UnsupportedOperationException(); - } + @Override + public V put(final CompositeMap map, final Map[] composited, final K key, final V value) { + pass = true; + return (V) "foo"; + } - @Override - public void resolveCollision(final CompositeMap composite, - final Map existing, - final Map added, - final Collection intersect) { - throw new UnsupportedOperationException(); - } - }); + @Override + public void putAll(final CompositeMap map, final Map[] composited, final Map t) { + throw new UnsupportedOperationException(); + } + + @Override + public void resolveCollision(final CompositeMap composite, final Map existing, final Map added, final Collection intersect) { + throw new UnsupportedOperationException(); + } + }); map.put((K) "willy", (V) "wonka"); assertTrue(pass); @@ -131,28 +126,24 @@ public class CompositeMapTest extends AbstractIterableMapTest { @Test public void testPutAll() { - final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator() { - private static final long serialVersionUID = 1L; - @Override - public V put(final CompositeMap map, final Map[] composited, final K key, - final V value) { - throw new UnsupportedOperationException(); - } + final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator() { + private static final long serialVersionUID = 1L; - @Override - public void putAll(final CompositeMap map, final Map[] composited, final Map t) { - pass = true; - } + @Override + public V put(final CompositeMap map, final Map[] composited, final K key, final V value) { + throw new UnsupportedOperationException(); + } - @Override - public void resolveCollision(final CompositeMap composite, - final Map existing, - final Map added, - final Collection intersect) { - throw new UnsupportedOperationException(); - } - }); + @Override + public void putAll(final CompositeMap map, final Map[] composited, final Map t) { + pass = true; + } + + @Override + public void resolveCollision(final CompositeMap composite, final Map existing, final Map added, final Collection intersect) { + throw new UnsupportedOperationException(); + } + }); map.putAll(null); assertTrue(pass); @@ -186,7 +177,7 @@ public class CompositeMapTest extends AbstractIterableMapTest { map.addComposited(three); assertTrue(map.containsKey("5")); - //Now remove "5" + // Now remove "5" map.remove("5"); assertFalse(three.containsKey("5")); } @@ -201,36 +192,31 @@ public class CompositeMapTest extends AbstractIterableMapTest { map.addComposited(three); assertTrue(map.containsKey("5")); - //Now remove "5" + // Now remove "5" three.remove("5"); assertFalse(map.containsKey("5")); } @Test public void testResolveCollision() { - final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator() { - private static final long serialVersionUID = 1L; + final CompositeMap map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator() { + private static final long serialVersionUID = 1L; - @Override - public V put(final CompositeMap map, final Map[] composited, final K key, - final V value) { - throw new UnsupportedOperationException(); - } + @Override + public V put(final CompositeMap map, final Map[] composited, final K key, final V value) { + throw new UnsupportedOperationException(); + } - @Override - public void putAll(final CompositeMap map, final Map[] composited, final Map t) { - throw new UnsupportedOperationException(); - } + @Override + public void putAll(final CompositeMap map, final Map[] composited, final Map t) { + throw new UnsupportedOperationException(); + } - @Override - public void resolveCollision(final CompositeMap composite, - final Map existing, - final Map added, - final Collection intersect) { - pass = true; - } - }); + @Override + public void resolveCollision(final CompositeMap composite, final Map existing, final Map added, final Collection intersect) { + pass = true; + } + }); map.addComposited(buildOne()); assertTrue(pass);