summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-common/vpp-translate-utils/src/test')
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/NamingContextTest.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/NamingContextTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/NamingContextTest.java
index 4e66315e1..c85a874c3 100644
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/NamingContextTest.java
+++ b/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/NamingContextTest.java
@@ -17,6 +17,7 @@
package io.fd.hc2vpp.common.translate.util;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -104,6 +105,13 @@ public class NamingContextTest implements InjectablesProcessor {
.build());
}
+ @Test(expected = IllegalArgumentException.class)
+ public void getAndThrow() {
+ when(mappingContext.read(any())).thenReturn(Optional.absent());
+ namingContext
+ .getIndex("non-existing", mappingContext, () -> new IllegalArgumentException("Non existing index"));
+ }
+
private Mapping filterForParent(final String parent) {
return mappings.getMapping().stream()
.filter(mapping -> mapping.getName().equals(parent))