### Question:
Device extends AbstractEntity { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); return result; } protected  Device();  Device(final String name);  Device(final String name, final DeviceInfoReport deviceInfo); static Device getInstance(final String xml); final String getName(); final void setName(final String name); final DeviceInfoReport getDeviceInfo(); final void setDeviceInfo(final DeviceInfoReport deviceInfo); final DeviceGroup getDeviceGroup(); final void setDeviceGroup(final DeviceGroup deviceGroup); final String toXML(); final Timestamp getLastReportTimestamp(); void setLastReportTimestamp(final Timestamp timestamp); final void clearOverride(); final void overrideState(final String newOverrideReason); final String getOverrideReason(); boolean isStateOverridden(); HealthStatus getHealthStatus(); void setHealthStatus(final HealthStatus healthStatus); AppraisalStatus.Status getSupplyChainStatus(); void setSupplyChainStatus(final AppraisalStatus.Status supplyChainValidationStatus); String getSummaryId(); void setSummaryId(final String summaryId); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }### Answer:
@Test public void testDeviceHashCode() throws Exception { final String name = "my-laptop"; final String otherName = "my-laptop"; final DeviceInfoReport deviceInfo = DeviceInfoReportTest.getTestReport(); final Device device = new Device(name, deviceInfo); final Device other = new Device(otherName, deviceInfo); Assert.assertTrue(device.hashCode() == other.hashCode()); }
@Test public void testDeviceHashCodeNotEqual() throws Exception { final String name = "my-laptop"; final String otherName = "my-other-laptop"; final DeviceInfoReport deviceInfo = DeviceInfoReportTest.getTestReport(); final Device device = new Device(name, deviceInfo); final Device other = new Device(otherName, deviceInfo); Assert.assertFalse(device.hashCode() == other.hashCode()); }