DefaultAlarmStateChangeNotification extends NetconfNotification { @Override public Element getNotificationElement() { Element alarmNotificationElement = super.getNotificationElement(); if (alarmNotificationElement == null) { alarmNotificationElement = getAlarmNotificationElement(); setNotificationElement(alarmNotificationElement); } return alarmNotificationElement; } DefaultAlarmStateChangeNotification(SchemaRegistry schemaRegistry, ModelNodeDataStoreManager dsm); AlarmNotification getAlarmNotification(); void setAlarmNotification(AlarmNotification alarms); @Override Element getNotificationElement(); @Override String toString(); @Override QName getType(); ModelNodeDataStoreManager getModelNodeDSM(); static final QName TYPE; }
@Test public void testGetNotificationElement() throws NetconfMessageBuilderException { when(m_alarmNotification.getResource()).thenReturn(TEST_RESOURCE); when(m_alarmNotification.getAlarmTypeId()).thenReturn(TEST_ALARM_TYPE_ID); when(m_alarmNotification.getAlarmTypeQualifier()).thenReturn(TEST_ALARM_TYPE_QUALIFIER); Timestamp testTimestamp = mock(Timestamp.class); when(m_alarmNotification.getLastStatusChange()).thenReturn(testTimestamp); AlarmSeverity testAlarmSeverity = AlarmSeverity.CLEAR; AlarmCondition testAlarmCondition = AlarmCondition.ALARM_OFF; when(m_alarmNotification.getLastPerceivedSeverity()).thenReturn(testAlarmSeverity); when(m_alarmNotification.getAlarmCondition()).thenReturn(testAlarmCondition); when(m_schemaRegistry.getPrefix(AlarmConstants.ALARM_NAMESPACE)).thenReturn(TEST_NAMESPACE); assertNotNull(m_alarmStateChangeNotification.getNotificationElement()); }