### Question:
SwitchTrackingService implements IOFSwitchListener, IService { @Override @NewCorrelationContextRequired public void switchChanged(final DatapathId switchId) { dashboardLogger.onSwitchEvent(switchId, SwitchChangeType.CHANGED); switchDiscovery(switchId, SwitchChangeType.CHANGED); }  void dumpAllSwitches(); void completeSwitchActivation(DatapathId dpId); @Override @NewCorrelationContextRequired void switchAdded(final DatapathId switchId); @Override @NewCorrelationContextRequired void switchRemoved(final DatapathId switchId); @Override @NewCorrelationContextRequired void switchActivated(final DatapathId switchId); @Override @NewCorrelationContextRequired void switchDeactivated(final DatapathId switchId); @Override @NewCorrelationContextRequired void switchChanged(final DatapathId switchId); @Override @NewCorrelationContextRequired void switchPortChanged(final DatapathId switchId, final OFPortDesc portDesc, final PortChangeType type); @Override void setup(FloodlightModuleContext context);  }### Answer:
@Test public void switchChanged() throws Exception { SpeakerSwitchView expectedSwitchRecord = makeSwitchRecord(dpId, switchFeatures, true, true); Capture<Message> producedMessage = prepareAliveSwitchEvent(expectedSwitchRecord); replayAll(); service.switchChanged(dpId); verifySwitchEvent(SwitchChangeType.CHANGED, expectedSwitchRecord, producedMessage); }
@Test public void switchChangedMissing() throws Exception { Capture<Message> producedMessage = prepareRemovedSwitchEvent(); replayAll(); service.switchChanged(dpId); verifySwitchEvent(SwitchChangeType.CHANGED, null, producedMessage); }