@Test public void equalityTests() { assertThat(new ProblemPosition(5).equals(new ProblemPosition(5))).isTrue(); assertThat( new ProblemPosition(5, Range.closed(100, 200)).equals(new ProblemPosition(5, Range.closed(100, 200)))) .isTrue(); assertThat(new ProblemPosition(5).equals(new Object())).isFalse(); assertThat(new ProblemPosition(5).equals(new ProblemPosition(6))).isFalse(); assertThat(new ProblemPosition(5).equals(new ProblemPosition(5, Range.closed(100, 200)))).isFalse(); assertThat( new ProblemPosition(5, Range.closed(100, 200)).equals(new ProblemPosition(5, Range.closed(101, 200)))) .isFalse(); assertThat( new ProblemPosition(5, Range.closed(100, 200)).equals(new ProblemPosition(5, Range.closed(100, 201)))) .isFalse(); }
@Override public boolean equals(final Object obj) { if (obj instanceof ProblemPosition) { final ProblemPosition that = (ProblemPosition) obj; return this.line == that.line && Objects.equals(this.range, that.range); } return false; }
ProblemPosition { @Override public boolean equals(final Object obj) { if (obj instanceof ProblemPosition) { final ProblemPosition that = (ProblemPosition) obj; return this.line == that.line && Objects.equals(this.range, that.range); } return false; } }
ProblemPosition { @Override public boolean equals(final Object obj) { if (obj instanceof ProblemPosition) { final ProblemPosition that = (ProblemPosition) obj; return this.line == that.line && Objects.equals(this.range, that.range); } return false; } ProblemPosition(final int line);  ProblemPosition(final int line, final Range<Integer> range); }
ProblemPosition { @Override public boolean equals(final Object obj) { if (obj instanceof ProblemPosition) { final ProblemPosition that = (ProblemPosition) obj; return this.line == that.line && Objects.equals(this.range, that.range); } return false; } ProblemPosition(final int line);  ProblemPosition(final int line, final Range<Integer> range); static ProblemPosition fromRegion(final FileRegion region); int getLine(); Optional<Range<Integer>> getRange(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); }
ProblemPosition { @Override public boolean equals(final Object obj) { if (obj instanceof ProblemPosition) { final ProblemPosition that = (ProblemPosition) obj; return this.line == that.line && Objects.equals(this.range, that.range); } return false; } ProblemPosition(final int line);  ProblemPosition(final int line, final Range<Integer> range); static ProblemPosition fromRegion(final FileRegion region); int getLine(); Optional<Range<Integer>> getRange(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode();  }