### Question:
AggregatingAlertProvider implements AlertProvider, AlertSourceAggregator, AlertNotifyReceiver, Consumer<Event<Alert>> { @Override public Optional<Alert> getAlert(ID id) { SourceAlertID alertId = asSourceAlertId(id); AlertSource src = getSource(alertId.sourceId); if (src != null) { return getAlert(alertId.alertId, src, false); } else { return null; } } AggregatingAlertProvider(); void setAvailableAlertsExecutor(Executor availableAlertsExecutor); @Override void accept(Event<Alert> event); @Override AlertCriteria criteria(); @Override ID resolve(Serializable value); @Override ID resolve(ID id, AlertSource source); @Override void addListener(AlertListener listener); @Override void addResponder(AlertResponder responder); @Override boolean addAlertSource(AlertSource src); @Override boolean removeAlertSource(AlertSource src); @Override boolean addAlertManager(AlertManager mgr); @Override boolean removeAlertManager(AlertManager mgr); @Override Optional<Alert> getAlert(ID id); Optional<Alert> getAlertAsServiceAccount(ID id); @Override Iterator<? extends Alert> getAlerts(AlertCriteria criteria); Iterator<? extends AlertSummary> getAlertsSummary(AlertCriteria criteria); @Override Iterator<? extends Alert> getAlertsAfter(DateTime time); @Override Iterator<? extends Alert> getAlertsModifiedAfter(DateTime time); @Override Iterator<? extends Alert> getAlertsBefore(DateTime time); @Override void respondTo(ID id, AlertResponder responder); @Override void alertsAvailable(int count); Optional<Alert> getAlert(Alert.ID id, AlertSource src, boolean asServiceAccount); Alert unwrapAlert(Alert proxy);  }### Answer:
@Test public void testGetAlert() { TestAlert mgrAlert = new TestAlert(this.manager); TestAlert srcAlert = new TestAlert(this.source); SourceAlertID mgrId = new SourceAlertID(mgrAlert.getId(), this.manager); SourceAlertID srcId = new SourceAlertID(srcAlert.getId(), this.source); this.provider.addAlertSource(this.source); this.provider.addAlertManager(this.manager); when(this.source.getAlert(any(Alert.ID.class))).thenReturn(Optional.of(srcAlert)); when(this.source.getAlertAsServiceAccount(any(Alert.ID.class))).thenReturn(Optional.of(srcAlert)); when(this.manager.getAlert(any(Alert.ID.class))).thenReturn(Optional.of(mgrAlert)); when(this.manager.getAlertAsServiceAccount(any(Alert.ID.class))).thenReturn(Optional.of(mgrAlert)); Alert getMgrAlert = providerToSourceAlertFunction().apply(this.provider.getAlert(mgrId).get()); Alert getSrcAlert = providerToSourceAlertFunction().apply(this.provider.getAlert(srcId).get()); assertThat(getMgrAlert).isEqualTo(mgrAlert); assertThat(getSrcAlert).isEqualTo(srcAlert); }