Span implements Comparable<Span> { @Override public boolean equals(Object o) { boolean result; if (o == this) { result = true; } else if (o instanceof Span) { Span s = (Span) o; result = (getStart() == s.getStart()) && (getEnd() == s.getEnd()) && (getType() != null ? type.equals(s.getType()) : true) && (s.getType() != null ? s.getType().equals(getType()) : true); } else { result = false; } return result; } Span(int s, int e, String type);  Span(int s, int e);  Span(Span span, int offset); int getStart(); int getEnd(); String getType(); int length(); boolean contains(Span s); boolean contains(int index); boolean startsWith(Span s); boolean intersects(Span s); boolean crosses(Span s); CharSequence getCoveredText(CharSequence text); int compareTo(Span s); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static String[] spansToStrings(Span[] spans, CharSequence s); static String[] spansToStrings(Span[] spans, String[] tokens);  }
@Test public void testEqualsWithNull() { Span a = new Span(0, 0); assertEquals(a.equals(null), false); }
@Test public void testEquals() { Span a1 = new Span(100, 1000, "test"); Span a2 = new Span(100, 1000, "test"); assertTrue(a1.equals(a2)); Span b1 = new Span(100, 100, "test"); assertFalse(a1.equals(b1)); Span c1 = new Span(100, 1000, "Test"); assertFalse(a1.equals(c1)); Span d1 = new Span(100, 1000); assertFalse(d1.equals(a1)); assertFalse(a1.equals(d1)); }