### Question:
DeviceEntity extends Entity implements RegistryEntity { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeviceEntity that = (DeviceEntity) o; return this.persistentId == that.persistentId && this.name.equals(that.name) && this.type.equals(that.type) && this.id.equals(that.id); } DeviceEntity();  DeviceEntity(String type, String name, String uri); String getType(); void setType(String type); String getName(); void setName(String name); String getID(); void setID(String uri); @Override int getPersistentId(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testEqualsSameObject() { assertThat(this.deviceEntity.equals(this.deviceEntity), equalTo(true)); }
@Test public void testEqualsOtherClass() { assertThat(this.deviceEntity.equals(""), equalTo(false)); assertThat(this.deviceEntity.equals(null), equalTo(false)); }
@Test public void testEquals() { DeviceEntity deviceEntity2 = new DeviceEntity("Smartphone", "Hello", "abc123"); assertThat(this.deviceEntity.equals(deviceEntity2), equalTo(true)); }
@Test public void testEqualsNotEqual() { DeviceEntity deviceEntity2 = new DeviceEntity("Smartphone", "Hello", "123"); assertThat(this.deviceEntity.equals(deviceEntity2), equalTo(false)); DeviceEntity deviceEntity3 = new DeviceEntity("Smartphone", "Hallo", "123"); assertThat(this.deviceEntity.equals(deviceEntity3), equalTo(false)); DeviceEntity deviceEntity4 = new DeviceEntity("Computer", "Hallo", "123"); assertThat(this.deviceEntity.equals(deviceEntity4), equalTo(false)); }