diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-09-22 10:12:29 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-22 10:14:24 +0200 |
commit | f1c8a1071d3fe1973198292328cb0f372f51b3b1 (patch) | |
tree | eec60dde05a25c5d2ce9a00d4bd57cab62afa751 | |
parent | e28fd9d2ad3e83adde22deb9f6a5f49e34b42eea (diff) |
Honeycomb-185: remove argumentCaptor from BDCustomizer and IfcCustomizerTests
Change-Id: Ic1f541c3c2d90c3ec4074bfe5c5a73d3cc6c4a49
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2 files changed, 16 insertions, 37 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java index 86c1df2fd..5a6376a63 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java @@ -16,7 +16,6 @@ package io.fd.honeycomb.translate.v3po.interfacesstate; -import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.Mockito.doReturn; @@ -36,7 +35,6 @@ import java.util.Collections; import java.util.List; import org.junit.Assert; import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder; @@ -91,12 +89,10 @@ public class InterfaceCustomizerTest extends private void verifySwInterfaceDumpWasInvoked(final int nameFilterValid, final String ifaceName, final int dumpIfcsInvocationCount) throws VppInvocationException { - // TODO HONEYCOMB-185 adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete - ArgumentCaptor<SwInterfaceDump> argumentCaptor = ArgumentCaptor.forClass(SwInterfaceDump.class); - verify(api, times(dumpIfcsInvocationCount)).swInterfaceDump(argumentCaptor.capture()); - final SwInterfaceDump actual = argumentCaptor.getValue(); - assertEquals(nameFilterValid, actual.nameFilterValid); - assertArrayEquals(ifaceName.getBytes(), actual.nameFilter); + final SwInterfaceDump expected = new SwInterfaceDump(); + expected.nameFilterValid = (byte)nameFilterValid; + expected.nameFilter = ifaceName.getBytes(); + verify(api, times(dumpIfcsInvocationCount)).swInterfaceDump(expected); } private static void assertIfacesAreEqual(final Interface iface, final SwInterfaceDetails details) { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java index d7a208f0d..aa238cd10 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java @@ -16,7 +16,6 @@ package io.fd.honeycomb.translate.v3po.vpp; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; @@ -38,7 +37,6 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; import org.junit.Before; import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainBuilder; @@ -97,36 +95,21 @@ public class BridgeDomainCustomizerTest { private void verifyBridgeDomainAddOrUpdateWasInvoked(final BridgeDomain bd, final int bdId) throws VppInvocationException { - final byte arpTerm = BridgeDomainTestUtils.booleanToByte(bd.isArpTermination()); - final byte flood = BridgeDomainTestUtils.booleanToByte(bd.isFlood()); - final byte forward = BridgeDomainTestUtils.booleanToByte(bd.isForward()); - final byte learn = BridgeDomainTestUtils.booleanToByte(bd.isLearn()); - final byte uuf = BridgeDomainTestUtils.booleanToByte(bd.isUnknownUnicastFlood()); - - // TODO HONEYCOMB-185 adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete - ArgumentCaptor<BridgeDomainAddDel> argumentCaptor = ArgumentCaptor.forClass(BridgeDomainAddDel.class); - verify(api).bridgeDomainAddDel(argumentCaptor.capture()); - final BridgeDomainAddDel actual = argumentCaptor.getValue(); - assertEquals(arpTerm, actual.arpTerm); - assertEquals(flood, actual.flood); - assertEquals(forward, actual.forward); - assertEquals(learn, actual.learn); - assertEquals(uuf, actual.uuFlood); - assertEquals(ADD_OR_UPDATE_BD, actual.isAdd); - assertEquals(bdId, actual.bdId); + final BridgeDomainAddDel expected = new BridgeDomainAddDel(); + expected.arpTerm = BridgeDomainTestUtils.booleanToByte(bd.isArpTermination()); + expected.flood = BridgeDomainTestUtils.booleanToByte(bd.isFlood()); + expected.forward = BridgeDomainTestUtils.booleanToByte(bd.isForward()); + expected.learn = BridgeDomainTestUtils.booleanToByte(bd.isLearn()); + expected.uuFlood = BridgeDomainTestUtils.booleanToByte(bd.isUnknownUnicastFlood()); + expected.isAdd = ADD_OR_UPDATE_BD; + expected.bdId = bdId; + verify(api).bridgeDomainAddDel(expected); } private void verifyBridgeDomainDeleteWasInvoked(final int bdId) throws VppInvocationException { - ArgumentCaptor<BridgeDomainAddDel> argumentCaptor = ArgumentCaptor.forClass(BridgeDomainAddDel.class); - verify(api).bridgeDomainAddDel(argumentCaptor.capture()); - final BridgeDomainAddDel actual = argumentCaptor.getValue(); - assertEquals(bdId, actual.bdId); - assertEquals(ZERO, actual.arpTerm); - assertEquals(ZERO, actual.flood); - assertEquals(ZERO, actual.forward); - assertEquals(ZERO, actual.learn); - assertEquals(ZERO, actual.uuFlood); - assertEquals(ZERO, actual.isAdd); + final BridgeDomainAddDel expected = new BridgeDomainAddDel(); + expected.bdId = bdId; + verify(api).bridgeDomainAddDel(expected); } private void whenBridgeDomainAddDelThenSuccess() |