ClassifierHandler { public Optional<String> getInterfaceNameFromClassifier(SclServiceFunctionForwarder theClassifier) { return Optional.ofNullable(theClassifier) .filter(classifier -> classifier.getAttachmentPointType() instanceof Interface) .map(classifier -> (Interface) classifier.getAttachmentPointType()) .map(Interface::getInterface); }  String buildFlowKeyName(String scfName, String aclName, String aceName, String type); Optional<String> getInterfaceNameFromClassifier(SclServiceFunctionForwarder theClassifier); FlowDetails deleteFlowFromTable(String nodeName, String flowKey, short tableID); FlowDetails addRspRelatedFlowIntoNode(String nodeName, FlowBuilder flow, long rspId); boolean usesLogicalInterfaces(ServiceFunctionForwarder theSff); Optional<Acl> extractAcl(ServiceFunctionClassifier scf);  }
@Test public void getInterfaceNameFromClassifierOK() { Optional<String> res = handler.getInterfaceNameFromClassifier(sffClassifier); Assert.assertTrue(res.isPresent()); Assert.assertEquals(INTERFACE_TO_CLASSIFY, res.get()); }
@Test public void getInterfaceNameFromClassifierWrongAttachmentPoint() { when(sffClassifier.getAttachmentPointType()).thenReturn(new BridgeBuilder().build()); Optional<String> res = handler.getInterfaceNameFromClassifier(sffClassifier); Assert.assertFalse(res.isPresent()); }
@Test public void getInterfaceNameFromClassifierNullClassifier() { Optional<String> res = handler.getInterfaceNameFromClassifier(null); Assert.assertFalse(res.isPresent()); }