### Question:
SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), speakerRequestBuildContext); } SpeakerFlowSegmentRequestBuilder(FlowResourcesManager resourcesManager); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath forwardPath,
                                                    FlowPath reversePath,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, Flow flow, FlowPath path); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            PathContext pathContext); @Override List<FlowSegmentRequestFactory> buildEgressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildEgressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath);  }### Answer:
@Test public void useActualFlowEndpoint() { Switch srcSwitch = Switch.builder().switchId(SWITCH_1).build(); Switch destSwitch = Switch.builder().switchId(SWITCH_2).build(); Flow origin = buildFlow(srcSwitch, 1, 5, destSwitch, 2, 0, 0); setSegmentsWithoutTransitSwitches( Objects.requireNonNull(origin.getForwardPath()), Objects.requireNonNull(origin.getReversePath())); FlowPath goalForwardPath = buildFlowPath( origin, origin.getSrcSwitch(), origin.getDestSwitch(), new FlowSegmentCookie( FlowPathDirection.FORWARD, cookieFactory.next())); FlowPath goalReversePath = buildFlowPath( origin, origin.getDestSwitch(), origin.getSrcSwitch(), new FlowSegmentCookie( FlowPathDirection.REVERSE, cookieFactory.next())); setSegmentsWithTransitSwitches(goalForwardPath, goalReversePath); Flow goal = Flow.builder() .flowId(origin.getFlowId()) .srcSwitch(origin.getSrcSwitch()) .srcPort(origin.getSrcPort()) .srcVlan(origin.getSrcVlan() + 10) .destSwitch(origin.getDestSwitch()) .destPort(origin.getDestPort()) .destVlan(origin.getDestVlan()) .bandwidth(origin.getBandwidth()) .encapsulationType(origin.getEncapsulationType()) .build(); goal.setForwardPath(origin.getForwardPath()); goal.setReversePath(origin.getReversePath()); goal.addPaths(goalForwardPath, goalReversePath); List<FlowSegmentRequestFactory> commands = target.buildIngressOnly( COMMAND_CONTEXT, goal, goalForwardPath, goalReversePath, SpeakerRequestBuildContext.EMPTY); boolean haveMatch = false; for (FlowSegmentRequestFactory entry : commands) { if (SWITCH_1.equals(entry.getSwitchId())) { haveMatch = true; Assert.assertTrue(entry instanceof IngressFlowSegmentRequestFactory); IngressFlowSegmentRequestFactory segment = (IngressFlowSegmentRequestFactory) entry; IngressFlowSegmentRequest request = segment.makeInstallRequest(commandIdGenerator.generate()); Assert.assertEquals(goal.getSrcVlan(), request.getEndpoint().getOuterVlanId()); } } Assert.assertTrue(haveMatch); }