From: Robert Varga Date: Tue, 4 Apr 2023 07:14:16 +0000 (+0200) Subject: Use ArgumentMatchers.anyCollection() X-Git-Tag: v12.0.0~171 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F105205%2F1;p=mdsal.git Use ArgumentMatchers.anyCollection() Remove type safety warnings by using a dedicated method for matching any collection. Change-Id: I4607cb370115ec375757cb15277c43890bf06b70 Signed-off-by: Robert Varga --- diff --git a/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/Mdsal298Test.java b/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/Mdsal298Test.java index 63dc96265b..48e15b7765 100644 --- a/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/Mdsal298Test.java +++ b/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/Mdsal298Test.java @@ -8,7 +8,7 @@ package org.opendaylight.mdsal.binding.dom.adapter; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyCollection; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; @@ -187,7 +187,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { public void testChoiceDataTreeModificationAddressable() throws InterruptedException, ExecutionException { final DataTreeChangeListener listener = assertWrittenWithChoice(); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(CONFIGURATION, ADDRESSABLE_CASE, new AddressableBuilder().build()); @@ -219,7 +219,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { final DataTreeChangeListener listener = assertWrittenContainer(AddressableCont.QNAME, AddressableCont.class, new AddressableContBuilder().build()); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(CONFIGURATION, ADDRESSABLE_CONTAINER.child(AddressableChild.class), @@ -252,7 +252,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { final DataTreeChangeListener listener = assertWrittenContainer(UnaddressableCont.QNAME, UnaddressableCont.class, new UnaddressableContBuilder().build()); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); final DOMDataTreeWriteTransaction domTx = getDomBroker().newWriteOnlyTransaction(); domTx.put(CONFIGURATION, YangInstanceIdentifier.create(UNADDRESSABLE_CONTAINER_NID) @@ -279,7 +279,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { public void testChoiceDataTreeModificationUnaddressable() throws InterruptedException, ExecutionException { final DataTreeChangeListener listener = assertWrittenWithChoice(); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); final DOMDataTreeWriteTransaction domTx = getDomBroker().newWriteOnlyTransaction(); domTx.put(CONFIGURATION, YangInstanceIdentifier.create(CHOICE_CONTAINER_NID).node(Foo.QNAME), @@ -313,7 +313,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { final Class bindingClass, final T expected) throws InterruptedException, ExecutionException { final DataTreeChangeListener listener = mock(DataTreeChangeListener.class); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); final DataTreeIdentifier dti = DataTreeIdentifier.create(CONFIGURATION, InstanceIdentifier.create(bindingClass)); @@ -342,14 +342,14 @@ public class Mdsal298Test extends AbstractDataBrokerTest { assertEquals(List.of(), changedContainer.getModifiedChildren()); reset(listener); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); return listener; } private DataTreeChangeListener assertWrittenWithChoice() throws InterruptedException, ExecutionException { final DataTreeChangeListener listener = mock(DataTreeChangeListener.class); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); getDataBroker().registerDataTreeChangeListener(CHOICE_CONTAINER_TID, listener); final DOMDataTreeWriteTransaction domTx = getDomBroker().newWriteOnlyTransaction(); @@ -378,7 +378,7 @@ public class Mdsal298Test extends AbstractDataBrokerTest { assertEquals(List.of(), changedContainer.getModifiedChildren()); reset(listener); - doNothing().when(listener).onDataTreeChanged(any(Collection.class)); + doNothing().when(listener).onDataTreeChanged(anyCollection()); return listener; }