AlarmParameters { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AlarmParameters other = (AlarmParameters) obj; 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_lastAlarmText == null) { if (other.m_lastAlarmText != null) { return false; } } else if (!m_lastAlarmText.equals(other.m_lastAlarmText)) { return false; } if (m_lastPerceivedSeverity != other.m_lastPerceivedSeverity) { return false; } if (m_lastStatusChange == null) { if (other.m_lastStatusChange != null) { return false; } } else if (!m_lastStatusChange.equals(other.m_lastStatusChange)) { return false; } if (m_resource == null) { if (other.m_resource != null) { return false; } } else if (!m_resource.equals(other.m_resource)) { return false; } if (m_resourceObjectString == null) { if (other.m_resourceObjectString != null) { return false; } } else if (!m_resourceObjectString.equals(other.m_resourceObjectString)) { return false; } if (m_resourceNamespaces == null) { if (other.m_resourceNamespaces != null) { return false; } } else if (!m_resourceNamespaces.equals(other.m_resourceNamespaces)) { return false; } return true; } AlarmParameters(String alarmTypeId, ModelNodeId resource, Timestamp lastStatusChange, AlarmSeverity lastPerceivedSeverity,
                           String lastAlarmText);  AlarmParameters(String alarmTypeId, String alarmTypeQualifier, ModelNodeId resource, Timestamp lastStatusChange,
                           AlarmSeverity lastPerceivedSeverity,
                           String lastAlarmText);  AlarmParameters(String alarmTypeId, String alarmTypeQualifier, ModelNodeId resource, Timestamp lastStatusChange,
                           AlarmSeverity lastPerceivedSeverity,
                           String lastAlarmText, String mountKey, String resourceObjectString); String getAlarmTypeId(); String getAlarmTypeQualifier(); ModelNodeId getResource(); Timestamp getLastStatusChange(); AlarmSeverity getLastPerceivedSeverity(); String getLastAlarmText(); String getMountKey(); void setMountKey(String mountKey); String getResourceObjectString(); void setResourceObjectString(String resourceObjectString); String getResourceNamespaces(); void setResourceNamespaces(String resourceNamespaces); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() { assertTrue(m_alarmParameters.equals(m_alarmParameters2)); assertFalse(m_AlarmParametersDifferentSeverity.equals(m_alarmParameters2)); assertFalse(m_alarmParameters.equals(null)); assertFalse(m_alarmParameters.equals("String literal")); m_alarmParameters = new AlarmParameters(null, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters3 = new AlarmParameters(TEST_ALARM_TYPE_ID, null, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters3.equals(m_alarmParameters2)); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID2, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, null); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT2); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, null, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange2, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, null, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE2, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertFalse(m_alarmParameters.equals(m_alarmParameters2)); m_alarmParameters = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); m_alarmParameters2 = new AlarmParameters(TEST_ALARM_TYPE_ID, TEST_ALARM_TYPE_QUALIFIER, TEST_RESOURCE, m_lastStatusChange, m_lastPerceivedSeverity, TEST_LAST_ALARM_TEXT); assertTrue(m_alarmParameters.equals(m_alarmParameters2)); assertEquals(m_alarmParameters.getMountKey(), m_alarmParameters2.getMountKey()); }