From f335d213be6acd95835003bb7f5e591018fc06c2 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 28 Oct 2016 13:12:19 +0200 Subject: HONEYCOMB-272: bump mockito version to 2.2.9 ArgumentMatchers.any() does not match null anymore, so some of the tests has been updated. Change-Id: I5de0fdfe87fc8e5c8ce24bfae8daeaba032195ff Signed-off-by: Marek Gradzki --- .../acl/ingress/IetfAclCustomizerTest.java | 45 +++------------------- .../interfaces/ip/Ipv4AddressCustomizerTest.java | 7 +--- 2 files changed, 7 insertions(+), 45 deletions(-) (limited to 'v3po/v3po2vpp') diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java index ccf1f83b3..8a4e9213d 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java @@ -35,10 +35,8 @@ import io.fd.vpp.jvpp.core.dto.InputAclSetInterface; import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply; import java.util.Arrays; import java.util.Collections; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.hamcrest.Matcher; import org.junit.Test; +import org.mockito.ArgumentMatcher; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; @@ -129,44 +127,13 @@ public class IetfAclCustomizerTest extends WriterCustomizerTest { inOrder.verify(api).inputAclSetInterface(inputAclSetInterfaceWriteRequest()); // assignment } - private Matcher actionOnMissEquals(final int action) { - return new BaseMatcher() { - public Object item; - - @Override - public void describeTo(final Description description) { - description.appendText("Expected ClassifyAddDelTable[missNextIndex=" + action + "] but was " + item); - } - - @Override - public boolean matches(final Object item) { - this.item = item; - if (item instanceof ClassifyAddDelTable) { - return ((ClassifyAddDelTable) item).missNextIndex == action; - } - return false; - } - }; + private ArgumentMatcher actionOnMissEquals(final int action) { + return table -> table.missNextIndex == action; } - private Matcher actionOnHitEquals(final int action) { - return new BaseMatcher() { - public Object item; - - @Override - public void describeTo(final Description description) { - description.appendText("Expected ClassifyAddDelSession[hitNextIndex=" + action + "] but was " + item); - } - - @Override - public boolean matches(final Object item) { - this.item = item; - if (item instanceof ClassifyAddDelSession) { - return ((ClassifyAddDelSession) item).hitNextIndex == action; - } - return false; - } - }; + + private ArgumentMatcher actionOnHitEquals(final int action) { + return session -> session.hitNextIndex == action; } private Deny deny() { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java index 522ab7297..00b424d9d 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java @@ -182,12 +182,7 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { private static ArgumentMatcher> matchInstanceIdentifier( Class desiredClass) { - return new ArgumentMatcher>() { - @Override - public boolean matches(final Object o) { - return o instanceof InstanceIdentifier && ((InstanceIdentifier) o).getTargetType().equals(desiredClass); - } - }; + return o -> o instanceof InstanceIdentifier && (o.getTargetType().equals(desiredClass)); } @Test(expected = WriteFailedException.UpdateFailedException.class) -- cgit 1.2.3-korg