### Question:
EntityId { public String id() { return id; } EntityId();  EntityId(final String id); String id(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }### Answer:
@Test public void shouldCreateEntityId_withId() { final String id = randomId(); final EntityIdStub entityId = new EntityIdStub(id); assertEquals(id, entityId.id()); }
@Test public void shouldCreateEntityIdWithUniqueNonEmptyId() { final Set<String> idSet = new HashSet<>(); for (int n = 0; n < RANDOM_SAMPLE_SIZE; n++) { final EntityIdStub entityIdStub = new EntityIdStub(); final String id = entityIdStub.id(); assertNotNull(id); assertFalse(id.trim().isEmpty()); idSet.add(id); } assertEquals(RANDOM_SAMPLE_SIZE, idSet.size()); }