### Question:
FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
        ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstPort, String proto, String ethType, Long metadata) { List<? extends ApplicationRuleFrame> applicationRuleFrames = framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId) .has(ApplicationRuleFrame.SRC_IP_PROPERTY, srcIp) .has(ApplicationRuleFrame.SRC_PORT_PROPERTY, srcPort) .has(ApplicationRuleFrame.DST_IP_PROPERTY, dstIp) .has(ApplicationRuleFrame.DST_PORT_PROPERTY, dstPort) .has(ApplicationRuleFrame.PROTO_PROPERTY, proto) .has(ApplicationRuleFrame.ETH_TYPE_PROPERTY, ethType) .has(ApplicationRuleFrame.METADATA_PROPERTY, metadata)) .toListExplicit(ApplicationRuleFrame.class); return applicationRuleFrames.isEmpty() ? Optional.empty() : Optional.of(applicationRuleFrames.get(0)) .map(ApplicationRule::new); } FermaApplicationRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp,
                                                              Integer srcPort, String dstIp, Integer dstPort,
                                                              String proto, String ethType, Long metadata); @Override Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp,
                                                                Integer srcPort, String dstIp, Integer dstPort,
                                                                String proto, String ethType, Long metadata); @Override Collection<ApplicationRule> findBySwitchId(SwitchId switchId); @Override Collection<ApplicationRule> findByFlowId(String flowId);  }### Answer:
@Test public void shouldLookupRuleByMatchAndFlow() { ApplicationRule ruleA = buildRuleA(); ApplicationRule foundRule = applicationRepository.lookupRuleByMatchAndFlow(ruleA.getSwitchId(), ruleA.getFlowId(), ruleA.getSrcIp(), ruleA.getSrcPort(), ruleA.getDstIp(), ruleA.getDstPort(), ruleA.getProto(), ruleA.getEthType(), ruleA.getMetadata()).get(); assertEquals(ruleA, foundRule); }