CitizenId implements Identity { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CitizenId)) return false; CitizenId citizenId = (CitizenId) o; return id.equals(citizenId.id); } CitizenId(String id); static boolean isValid(String id); @Override boolean validate(); @Override boolean isValidFormat(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); @Override String prettyPrint(); @Override String getId();  }
@Test public void testEquals() { CitizenId c1 = new CitizenId("161025581111"); CitizenId c2 = new CitizenId("161025581111"); assertEquals("2 Object with same id should be equal", c1, c2); }