summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-09-23 07:21:11 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-09-23 07:21:14 +0200
commite7a0775b21c2ea6b7bb8efb63b5384df26e27fbb (patch)
treed007d5f9df01f759d6996d2b1b9b1bd04bb8f35f /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
parenta4928d560b31df507472b17ac641c3f242d17b3a (diff)
HONEYCOMB-116: utility for stubbing jvpp methods
- introduces FutureProducer (inspired by https://gerrit.fd.io/r/#/c/2650/) - updates unit tests for v3po and lisp Change-Id: I56488bb1dcd6fcaf6821a58f99b528677e095662 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
index 05e48eeee..a227602b4 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
@@ -25,7 +25,7 @@ import io.fd.honeycomb.notification.NotificationCollector;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.v3po.test.ContextTestUtils;
import io.fd.honeycomb.translate.v3po.util.NamingContext;
-import java.util.concurrent.CompletableFuture;
+import io.fd.honeycomb.vpp.test.util.FutureProducer;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -40,7 +40,7 @@ import org.openvpp.jvpp.core.dto.WantInterfaceEventsReply;
import org.openvpp.jvpp.core.future.FutureJVppCore;
import org.openvpp.jvpp.core.notification.CoreNotificationRegistry;
-public class InterfaceChangeNotificationProducerTest {
+public class InterfaceChangeNotificationProducerTest implements FutureProducer {
private static final String IFC_CTX_NAME = "ifc-test-instance";
private static final String IFACE_NAME = "eth0";
@@ -68,13 +68,11 @@ public class InterfaceChangeNotificationProducerTest {
doReturn(notificationListenerReg).when(notificationRegistry).registerSwInterfaceSetFlagsNotificationCallback(
callbackArgumentCaptor.capture());
ContextTestUtils.mockMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
+ doReturn(future(new WantInterfaceEventsReply())).when(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class));
}
@Test
public void testStart() throws Exception {
- final CompletableFuture<WantInterfaceEventsReply> response = new CompletableFuture<>();
- response.complete(new WantInterfaceEventsReply());
- doReturn(response).when(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class));
final InterfaceChangeNotificationProducer interfaceChangeNotificationProducer =
new InterfaceChangeNotificationProducer(jVpp, namingContext, mappingContext);
@@ -91,9 +89,6 @@ public class InterfaceChangeNotificationProducerTest {
@Test
public void testNotification() throws Exception {
- final CompletableFuture<WantInterfaceEventsReply> response = new CompletableFuture<>();
- response.complete(new WantInterfaceEventsReply());
- doReturn(response).when(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class));
final InterfaceChangeNotificationProducer interfaceChangeNotificationProducer =
new InterfaceChangeNotificationProducer(jVpp, namingContext, mappingContext);