EmployeeId { public String sequenceNo() { return id.substring(id.length() - 4); } EmployeeId(String id); static EmployeeId from(String id); String sequenceNo(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void should_generate_employee_id_given_sequence_no() { employee.assignIdFrom("0101"); EmployeeId expected = new EmployeeId("201912240102"); assertThat(employee.id()).isEqualTo(expected); assertThat(employee.id().sequenceNo()).isEqualTo("0102"); }