### Question:
EntityId { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EntityId other = (EntityId) obj; if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } return true; } EntityId();  EntityId(final String id); String id(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }### Answer:
@Test public void shouldBeEquals_withSelf() { final String id = randomId(); final EntityIdStub entity = new EntityIdStub(id); final boolean isEquals = entity.equals(entity); assertTrue(isEquals); }
@Test public void shouldNotBeEquals_withNull() { final EntityIdStub entityIdStub = new EntityIdStub(); final EntityIdStub other = null; final boolean isEquals = entityIdStub.equals(other); assertFalse(isEquals); }
@Test public void shouldNotBeEquals_withDifferentClassInstance() { final EntityIdStub entityIdStub = new EntityIdStub(); final Object other = new Object(); final boolean isEquals = entityIdStub.equals(other); assertFalse(isEquals); }
@Test public void shouldNotBeEquals_withDifferentId() { final String id1 = randomId(); final String id2 = randomId(); final EntityIdStub entity1 = new EntityIdStub(id1); final EntityIdStub entity2 = new EntityIdStub(id2); final boolean isEquals = entity1.equals(entity2); assertFalse(isEquals); }