RyaType implements Comparable<RyaType> { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || !(o instanceof RyaType)) { return false; } final RyaType other = (RyaType) o; final EqualsBuilder builder = new EqualsBuilder() .append(getData(), other.getData()) .append(getDataType(), other.getDataType()) .append(getLanguage(), other.getLanguage()); return builder.isEquals(); } RyaType();  RyaType(final String data);  RyaType(final IRI dataType, final String data);  RyaType(final IRI dataType, final String data, final String language); IRI getDataType(); String getData(); void setDataType(final IRI dataType); void setData(final String data); String getLanguage(); void setLanguage(final String language); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final RyaType o);  }
@Test public void testEquals() throws Exception { Assert.assertTrue("Same data and datatype should be equal.", a.equals(same)); Assert.assertFalse("Same data, different datatype should be unequal.", a.equals(aIri)); Assert.assertFalse("Same datatype, different data should be unequal.", a.equals(b)); }
@Test public void testEqualsNullFields() throws Exception { Assert.assertFalse("equals(null) should return false.", a.equals(null)); Assert.assertFalse("Same data, one null datatype should be unequal.", a.equals(nullType)); Assert.assertFalse("Same datatype, one null data should be unequal.", a.equals(nullData)); Assert.assertFalse("Same datatype, data, one null lang should be unequal.", aLang.equals(nullLang)); final RyaType sameNull = new RyaType(null, null); Assert.assertTrue("Matching null fields should be equal.", sameNull.equals(nullBoth)); }