diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-05-02 10:41:35 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-05-02 11:31:10 +0000 |
commit | 9faea02da937dc9468f557a00ed5c9dacec7f2e2 (patch) | |
tree | 08d7ee5d4ce09d0d5669cd04eacd7c17f3f6f9c7 /lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java | |
parent | d8b2e9bf2db11dec21a8ebd27c038c4ab6bd1473 (diff) |
HC2VPP-131 - checking of lisp state before/after according to operation
Change-Id: I190562527c68d022a9b16fc76ad6a011161f4308
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
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.java | 33 |
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 |