diff options
author | Tibor Sirovatka <tsirovat@cisco.com> | 2016-06-10 15:42:30 +0200 |
---|---|---|
committer | Tibor Sirovatka <tsirovat@cisco.com> | 2016-06-14 14:45:30 +0200 |
commit | 9ad6dfd73089e26bb74cea9ab775cb9030dacb46 (patch) | |
tree | ea15b787d8b72dce88304ee67e6909d82b890308 /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java | |
parent | db0c27ecfeb80bac3ecb7b1fb34c7e20e60068ea (diff) |
HONEYCOMB-67: Minor corrections in tests, styles
Removed unnecessary calls from tests
Sonar corrections
Change-Id: Ib182d66fd47a4feb9686989d086482ffe188470f
Signed-off-by: Tibor Sirovatka <tsirovat@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java')
-rw-r--r-- | v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java index 2ad831f9f..a4fa2f188 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanGpeCustomizerTest.java @@ -101,7 +101,8 @@ public class VxlanGpeCustomizerTest { .augmentation(VppInterfaceAugmentation.class).child(VxlanGpe.class); } - private void whenVxlanGpeAddDelTunnelThen() throws ExecutionException, InterruptedException, VppBaseCallException { + private void whenVxlanGpeAddDelTunnelThenSuccess() + throws ExecutionException, InterruptedException, VppBaseCallException { final CompletionStage<VxlanGpeAddDelTunnelReply> replyCS = mock(CompletionStage.class); final CompletableFuture<VxlanGpeAddDelTunnelReply> replyFuture = mock(CompletableFuture.class); when(replyCS.toCompletableFuture()).thenReturn(replyFuture); @@ -110,35 +111,33 @@ public class VxlanGpeCustomizerTest { when(api.vxlanGpeAddDelTunnel(any(VxlanGpeAddDelTunnel.class))).thenReturn(replyCS); } - private void whenVxlanGpeAddDelTunnelThenSuccess() throws ExecutionException, InterruptedException, VppBaseCallException { - whenVxlanGpeAddDelTunnelThen(); - } - - private void whenVxlanGpeAddDelTunnelThenFailure() throws ExecutionException, InterruptedException, VppBaseCallException { - whenVxlanGpeAddDelTunnelFailedThen(-1); - } - /** * Failure response send */ - private void whenVxlanGpeAddDelTunnelFailedThen(final int retval) throws ExecutionException, InterruptedException, VppBaseCallException { - doReturn(TestHelperUtils.<VxlanAddDelTunnelReply>createFutureException(retval)).when(api).vxlanGpeAddDelTunnel(any(VxlanGpeAddDelTunnel.class)); + private void whenVxlanGpeAddDelTunnelThenFailure() + throws ExecutionException, InterruptedException, VppBaseCallException { + doReturn(TestHelperUtils.<VxlanAddDelTunnelReply>createFutureException()).when(api) + .vxlanGpeAddDelTunnel(any(VxlanGpeAddDelTunnel.class)); } - private VxlanGpeAddDelTunnel verifyVxlanGpeAddDelTunnelWasInvoked(final VxlanGpe vxlanGpe) throws VppBaseCallException{ + private VxlanGpeAddDelTunnel verifyVxlanGpeAddDelTunnelWasInvoked(final VxlanGpe vxlanGpe) + throws VppBaseCallException { ArgumentCaptor<VxlanGpeAddDelTunnel> argumentCaptor = ArgumentCaptor.forClass(VxlanGpeAddDelTunnel.class); verify(api).vxlanGpeAddDelTunnel(argumentCaptor.capture()); final VxlanGpeAddDelTunnel actual = argumentCaptor.getValue(); assertEquals(0, actual.isIpv6); - assertArrayEquals(InetAddresses.forString(vxlanGpe.getLocal().getIpv4Address().getValue()).getAddress(), actual.local); - assertArrayEquals(InetAddresses.forString(vxlanGpe.getRemote().getIpv4Address().getValue()).getAddress(), actual.remote); + assertArrayEquals(InetAddresses.forString(vxlanGpe.getLocal().getIpv4Address().getValue()).getAddress(), + actual.local); + assertArrayEquals(InetAddresses.forString(vxlanGpe.getRemote().getIpv4Address().getValue()).getAddress(), + actual.remote); assertEquals(vxlanGpe.getVni().getValue().intValue(), actual.vni); assertEquals(vxlanGpe.getNextProtocol().getIntValue(), actual.protocol); assertEquals(vxlanGpe.getEncapVrfId().intValue(), actual.encapVrfId); assertEquals(vxlanGpe.getDecapVrfId().intValue(), actual.decapVrfId); return actual; } - private void verifyVxlanGpeAddWasInvoked(final VxlanGpe vxlanGpe) throws VppBaseCallException{ + + private void verifyVxlanGpeAddWasInvoked(final VxlanGpe vxlanGpe) throws VppBaseCallException { final VxlanGpeAddDelTunnel actual = verifyVxlanGpeAddDelTunnelWasInvoked(vxlanGpe); assertEquals(ADD_VXLAN_GPE, actual.isAdd); } @@ -207,7 +206,8 @@ public class VxlanGpeCustomizerTest { assertTrue(e.getCause() instanceof VppBaseCallException); verifyVxlanGpeAddWasInvoked(vxlanGpe); // Mapping not stored due to failure - verify(mappingContext, times(0)).put(eq(getMappingIid(ifaceName, "test-instance")), eq(getMapping(ifaceName, 0).get())); + verify(mappingContext, times(0)) + .put(eq(getMappingIid(ifaceName, "test-instance")), eq(getMapping(ifaceName, 0).get())); return; } fail("WriteFailedException.CreateFailedException was expected"); |