diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-09-23 09:06:19 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-26 08:15:38 +0200 |
commit | 7ad1eb51710b65fdad35fab04122de4eb887e541 (patch) | |
tree | 512a725f33ca65bf211bc4c64ba2bd0d7c49a080 /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java | |
parent | a7147d16c31d9028c6b5dc557264433de0f11c91 (diff) |
HONEYCOMB-116: utility for stubbing MappingContext methods
- introduces MappingContextHelper (refactored ContextTestUtils)
- updates all v3po and lisp unit tests to use MCH
- updates lisp tests to mock EidMappingContext
Change-Id: I73b1adda767db71388ca1c4d7206cfd7ee9c70e1
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java')
-rw-r--r-- | v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java index 1fee0b3cf..86af0f094 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java @@ -25,7 +25,6 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; import io.fd.honeycomb.translate.v3po.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; @@ -91,8 +90,8 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest { public void setUp() throws Exception { namingContext = new NamingContext("generatedSubInterfaceName", IFC_TEST_INSTANCE); customizer = new SubInterfaceCustomizer(api, namingContext); - ContextTestUtils.mockMapping(mappingContext, SUB_IFACE_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE); - ContextTestUtils.mockMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_ID, IFC_TEST_INSTANCE); + defineMapping(mappingContext, SUB_IFACE_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE); + defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_ID, IFC_TEST_INSTANCE); } private SubInterface generateSubInterface(final boolean enabled, final List<Tag> tagList) { @@ -198,8 +197,8 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest { verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false)); verify(mappingContext) - .put(eq(ContextTestUtils.getMappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq( - ContextTestUtils.getMapping(SUB_IFACE_NAME, 0).get())); + .put(eq(mappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq( + mapping(SUB_IFACE_NAME, 0).get())); } @Test @@ -214,8 +213,8 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest { verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ANY_ID, true)); verify(mappingContext) - .put(eq(ContextTestUtils.getMappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq( - ContextTestUtils.getMapping(SUB_IFACE_NAME, 0).get())); + .put(eq(mappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq( + mapping(SUB_IFACE_NAME, 0).get())); } @Test @@ -231,8 +230,8 @@ public class SubInterfaceCustomizerTest extends WriterCustomizerTest { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false)); verify(mappingContext, times(0)).put( - eq(ContextTestUtils.getMappingIid(SUPER_IF_NAME, IFC_TEST_INSTANCE)), - eq(ContextTestUtils.getMapping(SUPER_IF_NAME, 0).get())); + eq(mappingIid(SUPER_IF_NAME, IFC_TEST_INSTANCE)), + eq(mapping(SUPER_IF_NAME, 0).get())); return; } fail("WriteFailedException.CreateFailedException was expected"); |