### Question:
Alarmd implements SpringServiceDaemon, DisposableBean { public AlarmPersister getPersister() { return m_persister; }  @EventHandler(uei = EventHandler.ALL_UEIS) void onEvent(Event e); void setPersister(AlarmPersister persister); AlarmPersister getPersister(); EventForwarder getEventForwarder(); void setEventForwarder(EventForwarder eventForwarder); @Override void afterPropertiesSet(); void destroy(); String getName(); void start(); void onNorthbounderRegistered(final Northbounder northbounder, final Map<String,String> properties); void onNorthbounderUnregistered(final Northbounder northbounder, final Map<String,String> properties); List<Northbounder> getNorthboundInterfaces(); void setNorthboundInterfaces(List<Northbounder> northboundInterfaces); static final String NAME; }### Answer:
@Test public void testNullEvent() throws Exception { ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("event argument must not be null")); try { m_alarmd.getPersister().persist(null); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }
@Test public void testNoLogmsg() throws Exception { EventBuilder bldr = new EventBuilder("testNoLogmsg", "AlarmdTest"); bldr.setAlarmData(new AlarmData()); ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("Incoming event has an illegal dbid (0), aborting")); try { m_alarmd.getPersister().persist(bldr.getEvent()); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }
@Test public void testNoAlarmData() throws Exception { EventBuilder bldr = new EventBuilder("testNoAlarmData", "AlarmdTest"); bldr.setLogMessage(null); m_alarmd.getPersister().persist(bldr.getEvent()); }
@Test public void testNoDbid() throws Exception { EventBuilder bldr = new EventBuilder("testNoDbid", "AlarmdTest"); bldr.setLogMessage(null); bldr.setAlarmData(new AlarmData()); ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("Incoming event has an illegal dbid (0), aborting")); try { m_alarmd.getPersister().persist(bldr.getEvent()); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }