### Question:
IMADeviceState extends DeviceState { @Override public final int hashCode() { final int prime = 31; int result = 1; result = prime * result + device.hashCode(); return result; } IMADeviceState(final Device device); protected  IMADeviceState(); final Long getId(); final void resetState(); final Device getDevice(); final String getBootcycleId(); final void setBootcycleId(final String bootcycleId); final int getIndex(); final void setIndex(final int index); final Date getMostRecentFullReportDate(); final void setMostRecentFullReportDate(final Date date); @Override Criterion getDeviceTrustAlertCriterion(); final byte[] getPcrState(); final void setPcrState(final byte[] pcrState); @Override final int hashCode(); @Override final boolean equals(final Object obj); @Override final String toString();  }### Answer:
@Test public void testEquivalence() { final Device device = new Device("Test Device"); final IMADeviceState state1 = new IMADeviceState(device); final IMADeviceState state2 = new IMADeviceState(device); Assert.assertEquals(state1, state2); Assert.assertEquals(state1.hashCode(), state2.hashCode()); }
@Test public void testNotEquivalent() { final Device device1 = new Device("Test Device 1"); final IMADeviceState state1 = new IMADeviceState(device1); final Device device2 = new Device("Test Device 2"); final IMADeviceState state2 = new IMADeviceState(device2); Assert.assertNotEquals(state1, state2); Assert.assertNotEquals(state1.hashCode(), state2.hashCode()); }