- /**
- * Tests {@link MultiTableMapCache#getMappingExactSD} method.
- */
- @Test
- public void getMappingExactSDTest() throws NoSuchMethodException, InvocationTargetException,
- IllegalAccessException {
- Method getMappingExactSD = MultiTableMapCache.class.getDeclaredMethod("getMappingExactSD", Eid.class, Eid.class,
- ILispDAO.class);
- getMappingExactSD.setAccessible(true);
-
- when(tableDaoMock.get(EID_IPV4_PREFIX_DST)).thenReturn(getEntry1());
- when(srcDstDaoMock.getSpecific(EID_IPV4_PREFIX_SRC, SubKeys.RECORD)).thenReturn(DUMMY_OBJECT);
-
- Object result = getMappingExactSD.invoke(
- multiTableMapCache, EID_IPV4_PREFIX_SRC, EID_IPV4_PREFIX_DST, tableDaoMock);
- assertEquals(DUMMY_OBJECT, result);
- }
-
- /**
- * Tests {@link MultiTableMapCache#getMappingExactSD} method with null src eid.
- */
- @Test
- public void getMappingExactSDTest_withNullSrcEid() throws NoSuchMethodException, InvocationTargetException,
- IllegalAccessException {
- Method getMappingExactSD = MultiTableMapCache.class.getDeclaredMethod("getMappingExactSD", Eid.class, Eid.class,
- ILispDAO.class);
- getMappingExactSD.setAccessible(true);
-
- when(tableDaoMock.get(EID_IPV4_PREFIX_DST)).thenReturn(getEntry1());
-
- Object result = getMappingExactSD.invoke(
- multiTableMapCache, null, EID_IPV4_PREFIX_DST, tableDaoMock);
- assertEquals(DUMMY_OBJECT, result);
- }
-
- /**
- * Tests {@link MultiTableMapCache#getMappingExactSD} method with null entry.
- */
- @Test
- public void getMappingExactSDTest_withNullEntry() throws NoSuchMethodException, InvocationTargetException,
- IllegalAccessException {
- Method getMappingExactSD = MultiTableMapCache.class.getDeclaredMethod("getMappingExactSD", Eid.class, Eid.class,
- ILispDAO.class);
- getMappingExactSD.setAccessible(true);
-
- when(tableDaoMock.get(EID_IPV4_PREFIX_DST)).thenReturn(null);
-
- Object result = getMappingExactSD.invoke(
- multiTableMapCache, null, EID_IPV4_PREFIX_DST, tableDaoMock);
- assertNull(result);
- }
-