Flow { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } Flow other = (Flow) obj; return Objects.equals(elements, other.elements) && exceptional == other.exceptional; } private  Flow(List<JavaFileScannerContext.Location> elements, boolean exceptional); @Override int hashCode(); @Override boolean equals(Object obj); boolean isNonExceptional(); Flow reverse(); Stream<JavaFileScannerContext.Location> stream(); Stream<JavaFileScannerContext.Location> firstFlowLocation(); List<JavaFileScannerContext.Location> elements(); boolean isEmpty(); static Flow empty(); static Flow of(JavaFileScannerContext.Location location); static Flow of(Flow currentFlow); static Builder builder();  }
@Test void testEquals() { Flow flow = Flow.builder() .add(locationWithMockTree("first")) .add(locationWithMockTree("second")) .build(); Flow flow1 = Flow.builder().addAll(flow).build(); Flow flow2 = Flow.builder().addAll(flow).setAsExceptional().build(); assertThat(flow1) .isNotEqualTo(null) .isNotEqualTo(new Object()) .isNotEqualTo(Flow.empty()) .isNotEqualTo(flow2) .isEqualTo(flow1) .isEqualTo(Flow.of(flow1)); }