This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 1d1bab626cda444d05295dd6ee14059b9c915c30 Author: Gary Gregory <[email protected]> AuthorDate: Thu Oct 3 17:43:12 2024 -0400 Checkstyle OK locally but not on GH CI Reformat experiment --- .../commons/collections4/map/CompositeMapTest.java | 132 +++++++++------------ 1 file changed, 59 insertions(+), 73 deletions(-) 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 <K> the key type. * @param <V> the value type. @@ -69,7 +68,7 @@ public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> { public CompositeMap<K, V> makeObject() { final CompositeMap<K, V> map = new CompositeMap<>(); map.addComposited(new HashMap<>()); - map.setMutator( new EmptyMapMutator<>() ); + map.setMutator(new EmptyMapMutator<>()); return map; } @@ -101,29 +100,25 @@ public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> { @Test @SuppressWarnings("unchecked") public void testPut() { - final CompositeMap<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator<K, V>() { - private static final long serialVersionUID = 1L; - @Override - public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, - final V value) { - pass = true; - return (V) "foo"; - } - - @Override - public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { - throw new UnsupportedOperationException(); - } - - @Override - public void resolveCollision(final CompositeMap<K, V> composite, - final Map<K, V> existing, - final Map<K, V> added, - final Collection<K> intersect) { - throw new UnsupportedOperationException(); - } - }); + final CompositeMap<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator<K, V>() { + private static final long serialVersionUID = 1L; + + @Override + public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, final V value) { + pass = true; + return (V) "foo"; + } + + @Override + public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { + throw new UnsupportedOperationException(); + } + + @Override + public void resolveCollision(final CompositeMap<K, V> composite, final Map<K, V> existing, final Map<K, V> added, final Collection<K> intersect) { + throw new UnsupportedOperationException(); + } + }); map.put((K) "willy", (V) "wonka"); assertTrue(pass); @@ -131,28 +126,24 @@ public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> { @Test public void testPutAll() { - final CompositeMap<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator<K, V>() { - private static final long serialVersionUID = 1L; - @Override - public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, - final V value) { - throw new UnsupportedOperationException(); - } - - @Override - public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { - pass = true; - } - - @Override - public void resolveCollision(final CompositeMap<K, V> composite, - final Map<K, V> existing, - final Map<K, V> added, - final Collection<K> intersect) { - throw new UnsupportedOperationException(); - } - }); + final CompositeMap<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator<K, V>() { + private static final long serialVersionUID = 1L; + + @Override + public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, final V value) { + throw new UnsupportedOperationException(); + } + + @Override + public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { + pass = true; + } + + @Override + public void resolveCollision(final CompositeMap<K, V> composite, final Map<K, V> existing, final Map<K, V> added, final Collection<K> intersect) { + throw new UnsupportedOperationException(); + } + }); map.putAll(null); assertTrue(pass); @@ -186,7 +177,7 @@ public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> { 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<K, V> extends AbstractIterableMapTest<K, V> { 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<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), - new CompositeMap.MapMutator<K, V>() { - private static final long serialVersionUID = 1L; - - @Override - public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, - final V value) { - throw new UnsupportedOperationException(); - } - - @Override - public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { - throw new UnsupportedOperationException(); - } - - @Override - public void resolveCollision(final CompositeMap<K, V> composite, - final Map<K, V> existing, - final Map<K, V> added, - final Collection<K> intersect) { - pass = true; - } - }); + final CompositeMap<K, V> map = new CompositeMap<>(buildOne(), buildTwo(), new CompositeMap.MapMutator<K, V>() { + private static final long serialVersionUID = 1L; + + @Override + public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, final V value) { + throw new UnsupportedOperationException(); + } + + @Override + public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) { + throw new UnsupportedOperationException(); + } + + @Override + public void resolveCollision(final CompositeMap<K, V> composite, final Map<K, V> existing, final Map<K, V> added, final Collection<K> intersect) { + pass = true; + } + }); map.addComposited(buildOne()); assertTrue(pass);
