### Question:
SmartHomeAlertHandler extends BasePlaceMonitorHandler { protected void postProcess(SubsystemContext<PlaceMonitorSubsystemModel> context, AlertScratchPad scratch) { context.setVariable(VAR_ALERTSCRATCH, scratch); final AlertScratchPad newScratch = scratch.copy(); postProcessors.forEach(postProcessor -> postProcessor.postProcess(context, scratch, newScratch)); List<Map<String,Object>> alerts = new LinkedList<Map<String, Object>>(newScratch.alerts() .stream() .sorted((SmartHomeAlert thingOne, SmartHomeAlert thingTwo) -> compareSeverity(thingOne, thingTwo)) .map(SmartHomeAlert::toMap) .collect(Collectors.toList()) ); context.model().setSmartHomeAlerts(alerts); } @Inject  SmartHomeAlertHandler(
      List<AlertGenerator> generators,
      List<AlertPostProcessor> postProcessors
   ); void onStarted(SubsystemContext<PlaceMonitorSubsystemModel> context); @OnMessage void onMessageReceived(SubsystemContext<PlaceMonitorSubsystemModel> context, PlatformMessage msg); @Override void onDeviceRemoved(Model model, SubsystemContext<PlaceMonitorSubsystemModel> context); @OnValueChanged void onModelChangeEvent(SubsystemContext<PlaceMonitorSubsystemModel> context, ModelChangedEvent changeEvent);  }### Answer:
@Test public void testDeleteAlertsForHub() { replay(); SmartHomeAlertHandler handle = new SmartHomeAlertHandler(this.generators, this.postProcessors); SmartHomeAlert hubOffline = SmartHomeAlerts.create( SmartHomeAlert.ALERTTYPE_PLACE_HUB_OFFLINE, SmartHomeAlert.SEVERITY_BLOCK, Address.platformService(PLACE_ID, PlaceCapability.NAMESPACE), ImmutableMap.of(), PLACE_ID ); SmartHomeAlert doorBattery = SmartHomeAlerts.create( SmartHomeAlert.ALERTTYPE_DEV_ERR_OFFLINE, SmartHomeAlert.SEVERITY_CRITICAL, this.door.getAddress(), ImmutableMap.of(), PLACE_ID ); SmartHomeAlert lockBattery = SmartHomeAlerts.create( SmartHomeAlert.ALERTTYPE_DEV_ERR_OFFLINE, SmartHomeAlert.SEVERITY_CRITICAL, this.lock.getAddress(), ImmutableMap.of(), PLACE_ID ); this.scratchPad.putAlert(doorBattery); this.scratchPad.putAlert(lockBattery); this.scratchPad.putAlert(hubOffline); handle.postProcess(this.context, this.scratchPad); List<Map<String, Object>> alerts = PlaceMonitorSubsystemModel.getSmartHomeAlerts(this.model, null); assertListHasAlert(hubOffline.getAlertkey(), alerts); assertListHasAlert(doorBattery.getAlertkey(), alerts); assertListNoAlert(lockBattery.getAlertkey(), alerts); assertEquals(hubOffline.getAlertkey(), alerts.get(0).get(SmartHomeAlert.ATTR_ALERTKEY)); }