summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/test/java')
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java6
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java13
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java13
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java10
4 files changed, 12 insertions, 30 deletions
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
index 80bb2c600..e2f55fdd1 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
@@ -79,7 +79,11 @@ public class NativeForwardPathsTableCustomizerTest extends WriterCustomizerTest
@Test
public void testUpdateValid() throws WriteFailedException {
when(api.gpeAddDelNativeFwdRpath(any())).thenReturn(future(new GpeAddDelNativeFwdRpathReply()));
- customizer.updateCurrentAttributes(validId, validTableBefore(), validTable(), writeContext);
+ final NativeForwardPathsTable before = validTableBefore();
+ final NativeForwardPathsTable after = validTable();
+ // emulates what default update would do
+ customizer.deleteCurrentAttributes(validId, before, writeContext);
+ customizer.writeCurrentAttributes(validId, after, writeContext);
verify(api, times(2)).gpeAddDelIface(requestCaptor.capture());
final List<GpeAddDelIface> requests = requestCaptor.getAllValues();
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
index 4d76f7d6f..a05866114 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
@@ -84,16 +84,9 @@ public class ItrRemoteLocatorSetCustomizerTest extends LispWriterCustomizerTest
fail("Test should have thrown exception");
}
- @Test
- public void updateCurrentAttributes() {
- try {
- customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- return;
- }
-
- fail("Test should have thrown exception");
+ @Test(expected = UnsupportedOperationException.class)
+ public void updateCurrentAttributes() throws WriteFailedException {
+ customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
}
@Test
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java
index edb648bd9..52ed5dfd1 100755
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java
@@ -18,7 +18,6 @@ package io.fd.hc2vpp.lisp.translate.write;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
@@ -121,18 +120,10 @@ public class LocatorSetCustomizerTest extends LispWriterCustomizerTest {
assertEquals(1, request.isAdd);
}
- @Test
+ @Test(expected = UnsupportedOperationException.class)
public void testUpdateCurrentAttributes() throws WriteFailedException {
final InstanceIdentifier<LocatorSet> identifier = InstanceIdentifier.create(LocatorSet.class);
- try {
- customizer
- .updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- assertEquals(identifier, e.getFailedId());
- return;
- }
- fail("Test should have failed");
+ customizer.updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext);
}
@Test(expected = NullPointerException.class)
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java
index 19f8b0af4..27c716080 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java
@@ -72,15 +72,9 @@ public class MapServerCustomizerTest extends LispWriterCustomizerTest implements
}
- @Test
+ @Test(expected = UnsupportedOperationException.class)
public void updateCurrentAttributes() throws Exception {
- try {
- customizer.updateCurrentAttributes(ID, data, data, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e instanceof WriteFailedException.UpdateFailedException);
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- verify(api, times(0)).oneAddDelMapServer(any());
- }
+ customizer.updateCurrentAttributes(ID, data, data, writeContext);
}
@Test