LogicalClassifierDataGetter { public static Optional<Long> getOpenflowPort(String theInterfaceName) { return SfcGeniusDataUtils.getInterfaceLowerLayerIf(theInterfaceName) .stream() .map(str -> str.split(":")) .filter(strArray -> strArray.length == 3) .map(strArray -> strArray[2]) .map(Long::parseLong) .findFirst(); } private  LogicalClassifierDataGetter();  LogicalClassifierDataGetter(SfcGeniusRpcClient theRpcClient); Optional<String> getInterfaceBetweenDpnIds(DpnIdType srcDpnId, DpnIdType dstDpnId); List<Action> getEgressActionsForTunnelInterface(String theTunnelInterface, int actionOffset); Optional<String> getNodeName(String theInterfaceName); Optional<DpnIdType> getFirstHopDataplaneId(RenderedServicePath theRsp); Optional<DpnIdType> getHopDataplaneId(RenderedServicePathHop hopData); static Optional<Long> getOpenflowPort(String theInterfaceName); static DpnIdType getDpnIdFromNodeName(String theNodeName);  }
@Test public void getOpenflowPortPositive() { Assert.assertEquals(new Long(2), LogicalClassifierDataGetter.getOpenflowPort(FIRST_SF_NEUTRON_PORT).get()); }
@Test public void getOpenflowPortNegative() { List<String> theInterfaces = new ArrayList<String>() {{ add("openflow:1234567890"); }} ; PowerMockito.when(SfcGeniusDataUtils.getInterfaceLowerLayerIf(anyString())).thenReturn(theInterfaces); Assert.assertFalse(LogicalClassifierDataGetter.getOpenflowPort(FIRST_SF_NEUTRON_PORT).isPresent()); }