ActionResolverUtils { protected static VirtualNode getDestinationVirtualRouterOfFlow(List<VirtualNode> virtualNodes, Flow flow, List<Node> nodes, List<IntentVnMappingResult> intentVnMappingResults) { MatchItemName matchItemName = new MatchItemName("dst-ip"); MatchItem matchItem = getMatchItem(flow.getMatchItem(), matchItemName); if ( null == matchItem ) { return null; } String matchItemValue = matchItem.getMatchItemValue().getStringValue(); VirtualNode virtualNode = getVirtualRouterWithIpPrefix(virtualNodes, matchItemValue, nodes, intentVnMappingResults); return virtualNode; }    }
@Test public void testGetDestinationVirtualRouterOfFlow() throws Exception { List<VirtualNode> virtualNodes = new ArrayList<VirtualNode>(); Flow flow = mock(Flow.class); List<Node> nodes = new ArrayList<Node>(); List<IntentVnMappingResult> intentVnMappingResults = new ArrayList<IntentVnMappingResult>(); MatchItem matchItem = mock(MatchItem.class); MatchItemValue matchItemValue = mock(MatchItemValue.class); List<MatchItem> matchItems = new ArrayList<MatchItem>(); matchItems.add(matchItem); when(flow.getMatchItem()).thenReturn(matchItems); when(matchItem.getMatchItemName()) .thenReturn(mock(MatchItemName.class)) .thenReturn(new MatchItemName("dst-ip")); Assert.assertTrue(ActionResolverUtils.getDestinationVirtualRouterOfFlow(virtualNodes, flow, nodes, intentVnMappingResults) == null); when(matchItem.getMatchItemValue()).thenReturn(matchItemValue); when(matchItemValue.getStringValue()).thenReturn(new String("test")); Assert.assertTrue(ActionResolverUtils.getDestinationVirtualRouterOfFlow(virtualNodes, flow, nodes, intentVnMappingResults) == null); }