summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java')
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java33
1 files changed, 27 insertions, 6 deletions
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java
index 4aa9335bc..78a897e71 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java
@@ -57,24 +57,45 @@ public class LispStateCheckServiceImplTest implements FutureProducer {
}
@Test(expected = IllegalStateException.class)
- public void testCheckLispEnabledNoConfig() throws Exception {
+ public void testCheckLispEnabledBeforeNoConfig() throws Exception {
+ when(writeContext.readBefore(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.absent());
+ impl.checkLispEnabledBefore(writeContext);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testCheckLispEnabledBeforeDisabledConfig() throws Exception {
+ when(writeContext.readBefore(InstanceIdentifier.create(Lisp.class)))
+ .thenReturn(Optional.of(new LispBuilder().setEnable(false).build()));
+ impl.checkLispEnabledBefore(writeContext);
+ }
+
+ @Test
+ public void testCheckLispEnabledBeforeEnabledConfig() throws Exception {
+ // no exception should be thrown here
+ when(writeContext.readBefore(InstanceIdentifier.create(Lisp.class)))
+ .thenReturn(Optional.of(new LispBuilder().setEnable(true).build()));
+ impl.checkLispEnabledBefore(writeContext);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testCheckLispEnabledAfterNoConfig() throws Exception {
when(writeContext.readAfter(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.absent());
- impl.checkLispEnabled(writeContext);
+ impl.checkLispEnabledAfter(writeContext);
}
@Test(expected = IllegalStateException.class)
- public void testCheckLispEnabledDisabledConfig() throws Exception {
+ public void testCheckLispEnabledAfterDisabledConfig() throws Exception {
when(writeContext.readAfter(InstanceIdentifier.create(Lisp.class)))
.thenReturn(Optional.of(new LispBuilder().setEnable(false).build()));
- impl.checkLispEnabled(writeContext);
+ impl.checkLispEnabledAfter(writeContext);
}
@Test
- public void testCheckLispEnabledEnabledConfig() throws Exception {
+ public void testCheckLispEnabledAfterEnabledConfig() throws Exception {
// no exception should be thrown here
when(writeContext.readAfter(InstanceIdentifier.create(Lisp.class)))
.thenReturn(Optional.of(new LispBuilder().setEnable(true).build()));
- impl.checkLispEnabled(writeContext);
+ impl.checkLispEnabledAfter(writeContext);
}
@Test