@Test public void testEquals() { assertFalse(getTestObject().equals(null)); assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); Location sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); Location differentObject = getTestObject(); differentObject.setGUID("Different"); assertFalse(getTestObject().equals(differentObject)); }
@Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Location)) { return false; } if (!super.equals(objectToCompare)) { return false; } Location location = (Location) objectToCompare; return Objects.equals(getDisplayName(), location.getDisplayName()) && Objects.equals(getDescription(), location.getDescription()); }
Location extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Location)) { return false; } if (!super.equals(objectToCompare)) { return false; } Location location = (Location) objectToCompare; return Objects.equals(getDisplayName(), location.getDisplayName()) && Objects.equals(getDescription(), location.getDescription()); } }
Location extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Location)) { return false; } if (!super.equals(objectToCompare)) { return false; } Location location = (Location) objectToCompare; return Objects.equals(getDisplayName(), location.getDisplayName()) && Objects.equals(getDescription(), location.getDescription()); } Location();  Location(Location templateLocation); }
Location extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Location)) { return false; } if (!super.equals(objectToCompare)) { return false; } Location location = (Location) objectToCompare; return Objects.equals(getDisplayName(), location.getDisplayName()) && Objects.equals(getDescription(), location.getDescription()); } Location();  Location(Location templateLocation); String getDisplayName(); void setDisplayName(String displayName); String getDescription(); void setDescription(String description); @Override String toString(); @Override boolean equals(Object objectToCompare); }
Location extends Referenceable { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof Location)) { return false; } if (!super.equals(objectToCompare)) { return false; } Location location = (Location) objectToCompare; return Objects.equals(getDisplayName(), location.getDisplayName()) && Objects.equals(getDescription(), location.getDescription()); } Location();  Location(Location templateLocation); String getDisplayName(); void setDisplayName(String displayName); String getDescription(); void setDescription(String description); @Override String toString(); @Override boolean equals(Object objectToCompare);  }