@Test public void testEquals() { System.out.println("equals"); EnvObject instanceA = new EnvObject(); EnvObject instanceB = new EnvObject(); System.out.println("Different object names and different address, expected false"); instanceA.setName("instanceA"); instanceA.setPhisicalAddress("addressA"); instanceA.setProtocol("protocolA"); instanceB.setName("instanceB"); instanceB.setPhisicalAddress("addressB"); instanceB.setProtocol("protocolB"); boolean expResult = false; boolean result = instanceA.equals(instanceB); assertEquals(expResult, result); System.out.println("Same object names and different address, expected true"); instanceA.setName("instanceA"); instanceA.setPhisicalAddress("addressA"); instanceA.setProtocol("protocolA"); instanceB.setName("instanceA"); instanceB.setPhisicalAddress("addressB"); instanceB.setProtocol("protocolB"); expResult = true; result = instanceA.equals(instanceB); assertEquals(expResult, result); System.out.println("Same object names in differenc cases and different address, expected true"); instanceA.setName("INSTANCEA"); instanceA.setPhisicalAddress("addressA"); instanceA.setProtocol("protocolA"); instanceB.setName("instanceA"); instanceB.setPhisicalAddress("addressB"); instanceB.setProtocol("protocolB"); expResult = true; result = instanceA.equals(instanceB); assertEquals(expResult, result); System.out.println("Different object names and same address, expected true"); instanceA.setName("instanceA"); instanceA.setPhisicalAddress("addressA"); instanceA.setProtocol("protocolA"); instanceB.setName("instanceB"); instanceB.setPhisicalAddress("addressA"); instanceB.setProtocol("protocolA"); expResult = true; result = instanceA.equals(instanceB); assertEquals(expResult, result); System.out.println("Different names unknown address/protocol. Expected false because 'unknown' is a placeholder"); instanceA.setName("instanceA"); instanceA.setPhisicalAddress("unknown"); instanceA.setProtocol("unknown"); instanceB.setName("instanceB"); instanceB.setPhisicalAddress("unknown"); instanceB.setProtocol("unknown"); expResult = false; result = instanceA.equals(instanceB); assertEquals(expResult, result); System.out.println("Same names unknown address/protocol. Expected true"); instanceA.setName("instanceA"); instanceA.setPhisicalAddress("unknown"); instanceA.setProtocol("unknown"); instanceB.setName("instanceA"); instanceB.setPhisicalAddress("unknown"); instanceB.setProtocol("unknown"); expResult = true; result = instanceA.equals(instanceB); assertEquals(expResult, result); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EnvObject other = (EnvObject) obj; if (!this.name.equalsIgnoreCase(other.name)) { if ((this.getPhisicalAddress().equalsIgnoreCase(other.getPhisicalAddress())) && (this.getProtocol().equalsIgnoreCase(other.getProtocol()))) { return (!this.getPhisicalAddress().equalsIgnoreCase(UNKNOWN_VALUE)) && (!this.getProtocol().equalsIgnoreCase(UNKNOWN_VALUE)); } else { return false; } } return true; }
EnvObject implements Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EnvObject other = (EnvObject) obj; if (!this.name.equalsIgnoreCase(other.name)) { if ((this.getPhisicalAddress().equalsIgnoreCase(other.getPhisicalAddress())) && (this.getProtocol().equalsIgnoreCase(other.getProtocol()))) { return (!this.getPhisicalAddress().equalsIgnoreCase(UNKNOWN_VALUE)) && (!this.getProtocol().equalsIgnoreCase(UNKNOWN_VALUE)); } else { return false; } } return true; } }
EnvObject implements Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EnvObject other = (EnvObject) obj; if (!this.name.equalsIgnoreCase(other.name)) { if ((this.getPhisicalAddress().equalsIgnoreCase(other.getPhisicalAddress())) && (this.getProtocol().equalsIgnoreCase(other.getProtocol()))) { return (!this.getPhisicalAddress().equalsIgnoreCase(UNKNOWN_VALUE)) && (!this.getProtocol().equalsIgnoreCase(UNKNOWN_VALUE)); } else { return false; } } return true; }  }
EnvObject implements Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EnvObject other = (EnvObject) obj; if (!this.name.equalsIgnoreCase(other.name)) { if ((this.getPhisicalAddress().equalsIgnoreCase(other.getPhisicalAddress())) && (this.getProtocol().equalsIgnoreCase(other.getProtocol()))) { return (!this.getPhisicalAddress().equalsIgnoreCase(UNKNOWN_VALUE)) && (!this.getProtocol().equalsIgnoreCase(UNKNOWN_VALUE)); } else { return false; } } return true; }  String getEnvironmentID(); void setEnvironmentID(String uuid); Properties getActions(); Properties getTriggers(); void setName(String name); String getName(); String getUUID(); void setUUID(String uuid); String getHierarchy(); void setHierarchy(String hierarchy); void setCurrentRepresentation(int index); Representation getCurrentRepresentation(); int getCurrentRepresentationIndex(); List<Representation> getRepresentations(); String getProtocol(); void setProtocol(String protocol); List<Behavior> getActiveBehaviors(); List<Behavior> getBehaviors(); Behavior getBehavior(String behavior); void setActAs(String actAs); String getActAs(); String getDescription(); void setDescription(String desc); void setType(String type); String getType(); String getPhisicalAddress(); void setPhisicalAddress(String address); FreedomShape getShape(); Map<String, String> getExposedProperties(); String getSimpleType(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); Set<String> getTagsList(); String getTagsString(); void initTags(); }
EnvObject implements Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EnvObject other = (EnvObject) obj; if (!this.name.equalsIgnoreCase(other.name)) { if ((this.getPhisicalAddress().equalsIgnoreCase(other.getPhisicalAddress())) && (this.getProtocol().equalsIgnoreCase(other.getProtocol()))) { return (!this.getPhisicalAddress().equalsIgnoreCase(UNKNOWN_VALUE)) && (!this.getProtocol().equalsIgnoreCase(UNKNOWN_VALUE)); } else { return false; } } return true; }  String getEnvironmentID(); void setEnvironmentID(String uuid); Properties getActions(); Properties getTriggers(); void setName(String name); String getName(); String getUUID(); void setUUID(String uuid); String getHierarchy(); void setHierarchy(String hierarchy); void setCurrentRepresentation(int index); Representation getCurrentRepresentation(); int getCurrentRepresentationIndex(); List<Representation> getRepresentations(); String getProtocol(); void setProtocol(String protocol); List<Behavior> getActiveBehaviors(); List<Behavior> getBehaviors(); Behavior getBehavior(String behavior); void setActAs(String actAs); String getActAs(); String getDescription(); void setDescription(String desc); void setType(String type); String getType(); String getPhisicalAddress(); void setPhisicalAddress(String address); FreedomShape getShape(); Map<String, String> getExposedProperties(); String getSimpleType(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); Set<String> getTagsList(); String getTagsString(); void initTags();  }