CitizenId implements Identity { @Override public boolean validate() { return isValidFormat() && !isRepeatNumber() && calculateCheckDigit() == getCheckDigit(); } 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 repeatNumberWithValidCheckDigit() { CitizenId cid; cid = new CitizenId("0000000000001"); assertFalse("repeat number with valid check digit should be Invalid", cid.validate()); cid = new CitizenId("1234123412340"); assertFalse("repeat pattern number with valid check digit should be Invalid", cid.validate()); }