AlarmInfo { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AlarmInfo other = (AlarmInfo) obj; if (m_alarmText == null) { if (other.m_alarmText != null) { return false; } } else if (!m_alarmText.equals(other.m_alarmText)) { return false; } if (m_alarmTypeId == null) { if (other.m_alarmTypeId != null) { return false; } } else if (!m_alarmTypeId.equals(other.m_alarmTypeId)) { return false; } if (m_alarmTypeQualifier == null) { if (other.m_alarmTypeQualifier != null) { return false; } } else if (!m_alarmTypeQualifier.equals(other.m_alarmTypeQualifier)) { return false; } if (m_time == null) { if (other.m_time != null) { return false; } } else if (!m_time.equals(other.m_time)) { return false; } if (m_severity != other.m_severity) { return false; } if (m_sourceObject == null) { if (other.m_sourceObject != null) { return false; } } else if (!m_sourceObject.equals(other.m_sourceObject)) { return false; } if (m_deviceName == null) { if (other.m_deviceName != null) { return false; } } else if (!m_deviceName.equals(other.m_deviceName)) { return false; } if (m_sourceObjectString == null) { if (other.m_sourceObjectString != null) { return false; } } else if (!m_sourceObjectString.equals(other.m_sourceObjectString)) { return false; } return true; } AlarmInfo(String alarmTypeId, ModelNodeId sourceObject, Timestamp time, AlarmSeverity severity,
                     String alarmText, String deviceName);  AlarmInfo(String alarmTypeId, String alarmTypeQualifier, ModelNodeId sourceObject, Timestamp time, AlarmSeverity severity,
                     String alarmText, String deviceName);  AlarmInfo(String alarmTypeId, String alarmTypeQualifier, ModelNodeId sourceObject, String sourceObjectNamespaces,
                     Timestamp eventTime, AlarmSeverity severity, String alarmText, String deviceName, String resourceString);  AlarmInfo(String alarmTypeId, String alarmTypeQualifier, ModelNodeId sourceObject, Timestamp time, AlarmSeverity severity,
                     String alarmText, String deviceName, String sourceObjectString); String getAlarmTypeId(); String getAlarmTypeQualifier(); ModelNodeId getSourceObject(); void setSourceObject(ModelNodeId sourceObject); Timestamp getTime(); AlarmSeverity getSeverity(); String getAlarmText(); String getDeviceName(); String getSourceObjectString(); void setSourceObjectString(String sourceObjectString); String getSourceObjectNamespaces(); void setSourceObjectNamespaces(String sourceObjectNamespaces); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() { assertTrue(m_alarmInfo.equals(m_alarmInfo2)); assertFalse(m_alarmInfoWithDifferentRaisedTime.equals(m_alarmInfo2)); assertFalse(m_alarmInfo.equals(null)); assertFalse(m_alarmInfo.equals("String literal")); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO2, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, null, TEST_DEVICE_ID); assertFalse(m_alarmInfo2.equals(m_alarmInfo)); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, null, m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo2.equals(m_alarmInfo)); m_alarmInfo = new AlarmInfo(null, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID2, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, null, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity2, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", null, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject2, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertTrue(m_raisedTime == m_raisedTime); assertTrue(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, null); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID2); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); m_alarmInfo = new AlarmInfo(TEST_ALARM_TYPE_ID, "", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); m_alarmInfo2 = new AlarmInfo(TEST_ALARM_TYPE_ID, "some value", m_sourceObject, m_raisedTime, m_severity, TEST_ADDITIONAL_INFO, TEST_DEVICE_ID); assertFalse(m_alarmInfo.equals(m_alarmInfo2)); assertFalse(m_alarmInfo.equals(m_alarmInfoWithSourceObjectString)); m_alarmInfo.setSourceObject(null); m_alarmInfo.setSourceObjectString(RESOURCETYPE_STRING); assertTrue(m_alarmInfo.equals(m_alarmInfoWithSourceObjectString)); }