OwnedEntity extends NamedEntity { public String getUserId() { return userId; } OwnedEntity();  OwnedEntity(String name);  OwnedEntity(String userId, String name);  OwnedEntity(OwnedEntity clone); String getUserId(); void setUserId(String userId); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void constructorName() { OwnedEntity another = new OwnedEntity(NAME); assertEquals("name not same.", NAME, another.getName()); assertNull("userId not null", another.getUserId()); }
@Test public void constructorUserIdAndName() { OwnedEntity another = new OwnedEntity(USER_ID, NAME); assertEquals("userId not same.", USER_ID, another.getUserId()); assertEquals("name not same.", NAME, another.getName()); }
@Test public void copyConstructor() { OwnedEntity another = new OwnedEntity(entity); assertEquals("userId not same.", entity.getUserId(), another .getUserId()); }