DefaultEntityId implements EntityId { public static DefaultEntityId of(final CharSequence entityId) { if (entityId instanceof DefaultEntityId) { return (DefaultEntityId) entityId; } return new DefaultEntityId(entityId); } private  DefaultEntityId(final CharSequence id); static DefaultEntityId of(final CharSequence entityId); static DefaultEntityId generateRandom(); static DefaultEntityId dummy(); @Override boolean isDummy(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void tryToGetInstanceFromNull() { assertThatNullPointerException() .isThrownBy(() -> DefaultEntityId.of(null)) .withMessage("The entityId must not be null!") .withNoCause(); }
@Test public void tryToGetInstanceFromEmptyString() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> DefaultEntityId.of("")) .withMessage("The argument 'entityId' must not be empty!") .withNoCause(); }