### Question:
AWSInstance { @Override public boolean equals(Object o){ if (this == o) { return true; } if (o == null || !getClass().equals(o.getClass())) { return false; } AWSInstance that = (AWSInstance) o; return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(application, that.application) && Objects.equals(instanceId, that.instanceId) && Objects.equals(ip, that.ip) && Objects.equals(status, that.status) && Objects.equals(platform, that.platform); } AWSInstance();  AWSInstance(String name, String application, String instanceId, String ip, String status, String platform); @Id @GeneratedValue Long getId(); String getName(); AWSInstance setName(String name); String getApplication(); AWSInstance setApplication(String application); String getInstanceId(); AWSInstance setInstanceId(String instanceId); String getIp(); AWSInstance setIp(String ip); String getStatus(); AWSInstance setStatus(String status); String getPlatform(); AWSInstance setPlatform(String platform); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals(){ Long id = 1L; String name = "The Dude"; String application = "TST"; String instanceId = "i-tst"; String ip = "127.0.0.1"; String state = "Running"; String platform ="Linux"; AWSInstance awsInstance = new AWSInstance(name, application, instanceId, ip, state,platform); awsInstance.setId(id); AWSInstance awsInstance2 = awsInstance; AWSInstance awsInstance3 = new AWSInstance(name, application, instanceId, ip, state,platform); awsInstance3.setId(id); Assert.assertEquals("Same address space", awsInstance, awsInstance2); Assert.assertEquals("Different Objects same values", awsInstance, awsInstance3); Assert.assertNotEquals("Different Object Types", awsInstance, "Hello World"); Assert.assertNotEquals("Different ids", awsInstance.setId(2L), awsInstance3); awsInstance.setId(id); Assert.assertNotEquals("Different name", awsInstance.setName(""), awsInstance3); awsInstance.setName(name); Assert.assertNotEquals("Different application", awsInstance.setApplication(""), awsInstance3); awsInstance.setApplication(application); Assert.assertNotEquals("Different instance Id", awsInstance.setInstanceId(""), awsInstance3); awsInstance.setInstanceId(instanceId); Assert.assertNotEquals("Different RequestorId", awsInstance.setIp(""), awsInstance3); awsInstance.setIp(ip); Assert.assertNotEquals("Different Platform", awsInstance.setPlatform(""), awsInstance3); awsInstance.setIp(platform); }