diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-09-22 13:17:00 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-22 14:28:04 +0200 |
commit | 723170e52190110fd21b86177373f8f22223b760 (patch) | |
tree | 72fcc37087a8eebbe8828faf207f1c72b1eadce5 /lisp/lisp2vpp | |
parent | f1c8a1071d3fe1973198292328cb0f372f51b3b1 (diff) |
HONEYCOMB-116: base classes for testing customizers
- adds base class for testing writers
- moves base classes to vpp-translate-test,
subproject of vpp-common
Change-Id: Ia42e2be3a95a33866d1996dd42a9bd1773b970a7
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp')
5 files changed, 52 insertions, 117 deletions
diff --git a/lisp/lisp2vpp/pom.xml b/lisp/lisp2vpp/pom.xml index 3553a2a07..b78ee8526 100755 --- a/lisp/lisp2vpp/pom.xml +++ b/lisp/lisp2vpp/pom.xml @@ -99,5 +99,11 @@ <artifactId>hamcrest-all</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>io.fd.honeycomb.vpp</groupId> + <artifactId>vpp-translate-test</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java index 6dccdfeab..0608c4a04 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java @@ -25,20 +25,16 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.base.Optional; -import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.v3po.util.NamingContext; import io.fd.honeycomb.translate.v3po.util.TranslateUtils; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.MappingBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSets; @@ -53,17 +49,7 @@ import org.openvpp.jvpp.core.dto.LispAddDelLocator; import org.openvpp.jvpp.core.dto.LispAddDelLocatorReply; import org.openvpp.jvpp.core.future.FutureJVppCore; - -public class InterfaceCustomizerTest { - - @Mock - private FutureJVppCore fakeJvpp; - - @Mock - private WriteContext writeContext; - - @Mock - private MappingContext mappingContext; +public class InterfaceCustomizerTest extends WriterCustomizerTest { @Captor private ArgumentCaptor<LispAddDelLocator> intfCaptor; @@ -75,10 +61,8 @@ public class InterfaceCustomizerTest { private Interface intf; private InterfaceCustomizer customizer; - @Before - public void init() { - MockitoAnnotations.initMocks(this); - + @Override + public void setUp() { id = InstanceIdentifier.builder(Lisp.class) .child(LocatorSets.class) .child(LocatorSet.class, new LocatorSetKey("Locator")) @@ -92,18 +76,16 @@ public class InterfaceCustomizerTest { namingContext = new NamingContext("PREFIX", "INSTANCE"); - customizer = new InterfaceCustomizer(fakeJvpp, namingContext); + customizer = new InterfaceCustomizer(api, namingContext); fakeReply = new LispAddDelLocatorReply(); completeFuture = new CompletableFuture<>(); completeFuture.complete(fakeReply); - when(writeContext.getMappingContext()).thenReturn(mappingContext); when(mappingContext.read(Mockito.any())) .thenReturn(Optional.of((DataObject) new MappingBuilder().setIndex(5).setName("interface").build())); - when(fakeJvpp.lispAddDelLocator(any(LispAddDelLocator.class))).thenReturn(completeFuture); - + when(api.lispAddDelLocator(any(LispAddDelLocator.class))).thenReturn(completeFuture); } @Test(expected = NullPointerException.class) @@ -136,7 +118,7 @@ public class InterfaceCustomizerTest { public void testWriteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException { customizer.writeCurrentAttributes(id, intf, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocator(intfCaptor.capture()); + verify(api, times(1)).lispAddDelLocator(intfCaptor.capture()); LispAddDelLocator request = intfCaptor.getValue(); @@ -150,13 +132,13 @@ public class InterfaceCustomizerTest { @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws WriteFailedException { - new InterfaceCustomizer(fakeJvpp, namingContext) + new InterfaceCustomizer(api, namingContext) .updateCurrentAttributes(null, null, null, null); } @Test(expected = NullPointerException.class) public void testDeleteCurrentAttributesNullData() throws WriteFailedException { - new InterfaceCustomizer(fakeJvpp, namingContext) + new InterfaceCustomizer(api, namingContext) .deleteCurrentAttributes(null, null, null); } @@ -184,7 +166,7 @@ public class InterfaceCustomizerTest { public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException { customizer.deleteCurrentAttributes(id, intf, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocator(intfCaptor.capture()); + verify(api, times(1)).lispAddDelLocator(intfCaptor.capture()); LispAddDelLocator request = intfCaptor.getValue(); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java index 2b28ce6b9..da9d50e7f 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java @@ -25,19 +25,15 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import io.fd.honeycomb.lisp.context.util.EidMappingContext; -import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.v3po.util.TranslateUtils; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp; @@ -57,11 +53,7 @@ import org.openvpp.jvpp.core.dto.LispAddDelLocalEidReply; import org.openvpp.jvpp.core.future.FutureJVppCore; -public class LocalMappingCustomizerTest { - - @Mock - private FutureJVppCore fakeJvpp; - +public class LocalMappingCustomizerTest extends WriterCustomizerTest { @Captor private ArgumentCaptor<LispAddDelLocalEid> mappingCaptor; @@ -72,13 +64,9 @@ public class LocalMappingCustomizerTest { private CompletableFuture<LispAddDelLocalEidReply> completeFuture; private LocalMappingCustomizer customizer; private EidMappingContext localMappingContext; - private WriteContext writeContext; - private MappingContext mappingCtx; - - @Before - public void init() { - MockitoAnnotations.initMocks(this); + @Override + public void setUp() { final Eid eid = new EidBuilder().setAddress( new Ipv4Builder().setIpv4( @@ -90,8 +78,6 @@ public class LocalMappingCustomizerTest { mappingId = new MappingId("REMOTE"); final LocalMappingKey key = new LocalMappingKey(mappingId); localMappingContext = new EidMappingContext("local"); - mappingCtx = mock(MappingContext.class); - writeContext = mock(WriteContext.class); mapping = new LocalMappingBuilder() .setEid(eid) @@ -108,11 +94,10 @@ public class LocalMappingCustomizerTest { fakeReply = new LispAddDelLocalEidReply(); completeFuture = new CompletableFuture<>(); completeFuture.complete(fakeReply); - customizer = new LocalMappingCustomizer(fakeJvpp, localMappingContext); + customizer = new LocalMappingCustomizer(api, localMappingContext); - when(fakeJvpp.lispAddDelLocalEid(any(LispAddDelLocalEid.class))).thenReturn(completeFuture); - when(writeContext.getMappingContext()).thenReturn(mappingCtx); - when(mappingCtx.read(Mockito.any())).thenReturn(com.google.common.base.Optional + when(api.lispAddDelLocalEid(any(LispAddDelLocalEid.class))).thenReturn(completeFuture); + when(mappingContext.read(Mockito.any())).thenReturn(com.google.common.base.Optional .of(new LocalMappingBuilder().setKey(key).setId(mappingId).setEid(eid).build())); } @@ -147,11 +132,11 @@ public class LocalMappingCustomizerTest { @Test public void testWriteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException { //to simulate no mapping - when(mappingCtx.read(Mockito.any())).thenReturn(com.google.common.base.Optional.absent()); + when(mappingContext.read(Mockito.any())).thenReturn(com.google.common.base.Optional.absent()); customizer.writeCurrentAttributes(id, mapping, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocalEid(mappingCaptor.capture()); + verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture()); LispAddDelLocalEid request = mappingCaptor.getValue(); @@ -174,7 +159,7 @@ public class LocalMappingCustomizerTest { public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException { customizer.deleteCurrentAttributes(id, mapping, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocalEid(mappingCaptor.capture()); + verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture()); LispAddDelLocalEid request = mappingCaptor.getValue(); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java index 9ed1d53cb..1bb695cc0 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java @@ -26,16 +26,13 @@ import static org.mockito.Mockito.when; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; -import io.fd.honeycomb.translate.MappingContext; -import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSets; @@ -48,37 +45,24 @@ import org.openvpp.jvpp.core.dto.LispAddDelLocatorSet; import org.openvpp.jvpp.core.dto.LispAddDelLocatorSetReply; import org.openvpp.jvpp.core.dto.LispLocatorSetDetails; import org.openvpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; -import org.openvpp.jvpp.core.future.FutureJVppCore; +public class LocatorSetCustomizerTest extends WriterCustomizerTest { -public class LocatorSetCustomizerTest { - - private FutureJVppCore fakeJvpp; private NamingContext locatorSetContext; - private MappingContext mappingContext; - private ModificationCache cache; - private WriteContext context; - @Before - public void init() { - fakeJvpp = mock(FutureJVppCore.class); + @Override + public void setUp() { locatorSetContext = new NamingContext("locator-set", "instance"); - context = mock(WriteContext.class); - mappingContext = mock(MappingContext.class); - cache = new ModificationCache(); - when(context.getMappingContext()).thenReturn(mappingContext); - when(context.getModificationCache()).thenReturn(cache); } - @Test(expected = NullPointerException.class) public void testWriteCurrentAttributesNullData() throws WriteFailedException { - new LocatorSetCustomizer(fakeJvpp, locatorSetContext).writeCurrentAttributes(null, null, null); + new LocatorSetCustomizer(api, locatorSetContext).writeCurrentAttributes(null, null, null); } @Test(expected = NullPointerException.class) public void testWriteCurrentAttributesBadData() throws WriteFailedException { - new LocatorSetCustomizer(fakeJvpp, locatorSetContext) + new LocatorSetCustomizer(api, locatorSetContext) .writeCurrentAttributes(null, mock(LocatorSet.class), null); } @@ -101,8 +85,8 @@ public class LocatorSetCustomizerTest { CompletableFuture<LispAddDelLocatorSetReply> completeFuture = new CompletableFuture<>(); completeFuture.complete(fakeReply); - when(fakeJvpp.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class))).thenReturn(completeFuture); - when(context.readAfter(validId)).thenReturn(Optional.of(locatorSet)); + when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class))).thenReturn(completeFuture); + when(writeContext.readAfter(validId)).thenReturn(Optional.of(locatorSet)); final LispLocatorSetDetailsReplyDump reply = new LispLocatorSetDetailsReplyDump(); LispLocatorSetDetails details = new LispLocatorSetDetails(); @@ -111,31 +95,30 @@ public class LocatorSetCustomizerTest { cache.put(io.fd.honeycomb.lisp.translate.read.LocatorSetCustomizer.LOCATOR_SETS_CACHE_ID, reply); - new LocatorSetCustomizer(fakeJvpp, locatorSetContext).writeCurrentAttributes(validId, locatorSet, context); + new LocatorSetCustomizer(api, locatorSetContext).writeCurrentAttributes(validId, locatorSet, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture()); + verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture()); LispAddDelLocatorSet request = locatorSetCaptor.getValue(); assertNotNull(request); assertEquals("Locator", new String(request.locatorSetName)); assertEquals(1, request.isAdd); - } @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws WriteFailedException { - new LocatorSetCustomizer(fakeJvpp, locatorSetContext).updateCurrentAttributes(null, null, null, null); + new LocatorSetCustomizer(api, locatorSetContext).updateCurrentAttributes(null, null, null, null); } @Test(expected = NullPointerException.class) public void testDeleteCurrentAttributesNullData() throws WriteFailedException { - new LocatorSetCustomizer(fakeJvpp, locatorSetContext).deleteCurrentAttributes(null, null, null); + new LocatorSetCustomizer(api, locatorSetContext).deleteCurrentAttributes(null, null, null); } @Test(expected = NullPointerException.class) public void testDeleteCurrentAttributesBadData() throws WriteFailedException { - new LocatorSetCustomizer(fakeJvpp, locatorSetContext) + new LocatorSetCustomizer(api, locatorSetContext) .deleteCurrentAttributes(null, mock(LocatorSet.class), null); } @@ -153,17 +136,16 @@ public class LocatorSetCustomizerTest { CompletableFuture<LispAddDelLocatorSetReply> completeFuture = new CompletableFuture<>(); completeFuture.complete(fakeReply); - when(fakeJvpp.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class))).thenReturn(completeFuture); + when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class))).thenReturn(completeFuture); - new LocatorSetCustomizer(fakeJvpp, locatorSetContext).deleteCurrentAttributes(null, locatorSet, context); + new LocatorSetCustomizer(api, locatorSetContext).deleteCurrentAttributes(null, locatorSet, writeContext); - verify(fakeJvpp, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture()); + verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture()); LispAddDelLocatorSet request = locatorSetCaptor.getValue(); assertNotNull(request); assertEquals("Locator", new String(request.locatorSetName)); assertEquals(0, request.isAdd); - } } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java index 7797db1f7..30c168e72 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java @@ -24,22 +24,16 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import io.fd.honeycomb.lisp.context.util.EidMappingContext; -import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.v3po.util.TranslateUtils; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction; @@ -54,18 +48,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.LocatorBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.openvpp.jvpp.core.dto.LispAddDelRemoteMapping; import org.openvpp.jvpp.core.dto.LispAddDelRemoteMappingReply; -import org.openvpp.jvpp.core.future.FutureJVppCore; -public class RemoteMappingCustomizerTest { - - @Mock - private FutureJVppCore fakeJvpp; +public class RemoteMappingCustomizerTest extends WriterCustomizerTest { @Captor private ArgumentCaptor<LispAddDelRemoteMapping> mappingCaptor; @@ -77,14 +65,9 @@ public class RemoteMappingCustomizerTest { private CompletableFuture<LispAddDelRemoteMappingReply> completeFuture; private InstanceIdentifier<RemoteMapping> id; private EidMappingContext remoteMappingContext; - private WriteContext writeContext; - private MappingContext mapping; - - - @Before - public void init() { - MockitoAnnotations.initMocks(this); + @Override + public void setUp() { final Eid eid = new EidBuilder().setAddress( new Ipv4Builder().setIpv4( new Ipv4Address("192.168.2.1")) @@ -94,8 +77,6 @@ public class RemoteMappingCustomizerTest { mappingId = new MappingId("REMOTE"); final RemoteMappingKey key = new RemoteMappingKey(mappingId); remoteMappingContext = new EidMappingContext("remote"); - mapping = mock(MappingContext.class); - writeContext = mock(WriteContext.class); intf = new RemoteMappingBuilder() @@ -112,11 +93,10 @@ public class RemoteMappingCustomizerTest { fakeReply = new LispAddDelRemoteMappingReply(); completeFuture = new CompletableFuture<>(); completeFuture.complete(fakeReply); - customizer = new RemoteMappingCustomizer(fakeJvpp, remoteMappingContext); + customizer = new RemoteMappingCustomizer(api, remoteMappingContext); - when(fakeJvpp.lispAddDelRemoteMapping(Mockito.any())).thenReturn(completeFuture); - when(writeContext.getMappingContext()).thenReturn(mapping); - when(mapping.read(Mockito.any())).thenReturn(com.google.common.base.Optional + when(api.lispAddDelRemoteMapping(Mockito.any())).thenReturn(completeFuture); + when(mappingContext.read(Mockito.any())).thenReturn(com.google.common.base.Optional .of(new RemoteMappingBuilder().setKey(key).setId(mappingId).setEid(eid).build())); } @@ -134,11 +114,11 @@ public class RemoteMappingCustomizerTest { @Test public void testWriteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException { //to simulate no mapping - when(mapping.read(Mockito.any())).thenReturn(com.google.common.base.Optional.absent()); + when(mappingContext.read(Mockito.any())).thenReturn(com.google.common.base.Optional.absent()); customizer.writeCurrentAttributes(id, intf, writeContext); - verify(fakeJvpp, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture()); + verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture()); LispAddDelRemoteMapping request = mappingCaptor.getValue(); @@ -162,7 +142,7 @@ public class RemoteMappingCustomizerTest { public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException { customizer.deleteCurrentAttributes(id, intf, writeContext); - verify(fakeJvpp, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture()); + verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture()); LispAddDelRemoteMapping request = mappingCaptor.getValue(); |