@Test public void testReverseDisposition() { Trace trace1 = new Trace(ACCEPTED, ImmutableList.of(HOP1)); Trace trace2 = new Trace(ACCEPTED, ImmutableList.of(HOP2)); Trace trace3 = new Trace(DENIED_IN, ImmutableList.of(HOP3)); Trace trace4 = new Trace(DENIED_OUT, ImmutableList.of(HOP3)); BidirectionalTrace bTrace1 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace1); BidirectionalTrace bTrace2 = new BidirectionalTrace(FLOW1, trace2, ImmutableSet.of(), FLOW1, trace2); BidirectionalTrace bTrace3 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace1); BidirectionalTrace bTrace4 = new BidirectionalTrace(FLOW1, trace2, ImmutableSet.of(), FLOW1, trace3); BidirectionalTrace bTrace5 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace4); Collection<BidirectionalTrace> pruned = prune(ImmutableList.of(bTrace1, bTrace2, bTrace3, bTrace4, bTrace5), 3); assertThat(pruned, containsInAnyOrder(bTrace1, bTrace4, bTrace5)); }
private static Optional<FlowDisposition> reverseDisposition(BidirectionalTrace trace) { return Optional.ofNullable(trace.getReverseTrace()).map(Trace::getDisposition); }
BidirectionalTracePruner { private static Optional<FlowDisposition> reverseDisposition(BidirectionalTrace trace) { return Optional.ofNullable(trace.getReverseTrace()).map(Trace::getDisposition); } }
BidirectionalTracePruner { private static Optional<FlowDisposition> reverseDisposition(BidirectionalTrace trace) { return Optional.ofNullable(trace.getReverseTrace()).map(Trace::getDisposition); } private  BidirectionalTracePruner(); }
BidirectionalTracePruner { private static Optional<FlowDisposition> reverseDisposition(BidirectionalTrace trace) { return Optional.ofNullable(trace.getReverseTrace()).map(Trace::getDisposition); } private  BidirectionalTracePruner(); static List<BidirectionalTrace> prune(List<BidirectionalTrace> objects, int maxSize); }
BidirectionalTracePruner { private static Optional<FlowDisposition> reverseDisposition(BidirectionalTrace trace) { return Optional.ofNullable(trace.getReverseTrace()).map(Trace::getDisposition); } private  BidirectionalTracePruner(); static List<BidirectionalTrace> prune(List<BidirectionalTrace> objects, int maxSize);  }