License { @Override public boolean equals(final Object obj){ if(obj instanceof License){ return hashCode() == obj.hashCode(); } return false; } protected  License(); String getName(); void setName(final String name); String getLongName(); void setLongName(final String longName); String getUrl(); void setUrl(final String url); String getComments(); void setComments(final String comments); String getRegexp(); void setRegexp(final String regexp); boolean isApproved(); void setApproved(final boolean approved); boolean isUnknown(); void setUnknown(boolean unknown); boolean isPending(); void setPending(boolean pending); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void checkEquals(){ License license = DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url"); License license2 = DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url"); License license3 = DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url&"); License license4 = DataModelFactory.createLicense("name", "longName", "comments", "regexp&", "url"); License license5 = DataModelFactory.createLicense("name", "longName", "comments&", "regexp", "url"); License license6 = DataModelFactory.createLicense("name", "longName&", "comments", "regexp", "url"); License license7 = DataModelFactory.createLicense("name&", "longName", "comments", "regexp", "url"); assertTrue(license.equals(license2)); assertFalse(license.equals(license3)); assertFalse(license.equals(license4)); assertFalse(license.equals(license5)); assertFalse(license.equals(license6)); assertFalse(license.equals(license7)); assertFalse(license.equals("test")); }