### Question:
DefaultAlertManager extends QueryDslRepositorySupport implements AlertManager, ClusterServiceMessageReceiver { @Override public Iterator<Alert> getAlerts(AlertCriteria criteria) { Long now = DateTime.now().getMillis(); Principal[] principal = null; if (criteria != null && criteria.isAsServiceAccount()) { principal = new Principal[1]; principal[0] = MetadataAccess.SERVICE; } else { principal = new Principal[0]; } if (criteria.isOnlyIfChangesDetected() && !hasAlertsChanged(criteria)) { log.debug("Returning cached Alerts data"); return new ArrayList(latestAlerts.get(criteria.toString()).getAlertList()).iterator(); } log.debug("Query for Alerts data"); List<Alert> alerts = this.metadataAccess.read(() -> { DefaultAlertCriteria critImpl = ensureAlertCriteriaType(criteria); return critImpl.createQuery().fetch().stream() .map(a -> asValue(a)) .collect(Collectors.toList()); }, principal); if (criteria.isOnlyIfChangesDetected()) { latestAlerts.put(criteria.toString(), new AlertsCache(now, alerts)); } return alerts.iterator(); } DefaultAlertManager(JpaAlertRepository repo); @Override AlertSource.ID getId(); @Override Alert.ID resolve(Serializable id); @Override Set<AlertDescriptor> getAlertDescriptors(); @Override void addReceiver(AlertNotifyReceiver receiver); @Override void removeReceiver(AlertNotifyReceiver receiver); @Override AlertCriteria criteria(); @Override Optional<Alert> getAlert(Alert.ID id); Optional<Alert> getAlertAsServiceAccount(Alert.ID id); Iterator<AlertSummary> getAlertsSummary(AlertCriteria criteria); @Override Iterator<Alert> getAlerts(AlertCriteria criteria); Set<String> getAlertTypes(); @Override boolean addDescriptor(AlertDescriptor descriptor); @Override Alert create(URI type, String subtype, Level level, String description, C content); @Override Alert createEntityAlert(URI type, Level level, String description, EntityIdentificationAlertContent<C> content); @Override AlertResponse getResponse(Alert alert); @Override Alert remove(Alert.ID id); @Override void updateLastUpdatedTime(); @Override Long getLastUpdatedTime(); EntityIdentificationAlertContent createEntityIdentificationAlertContent(String entityId, SecurityRole.ENTITY_TYPE entityType, C content); @Override void onMessageReceived(String from, ClusterMessage message);  }### Answer:
@Test(dependsOnGroups = "create", groups = "read1") public void testGetAlerts() { Iterator<Alert> itr = this.manager.getAlerts(this.manager.criteria().asServiceAccount(true)); Assertions.assertThat(itr) .isNotNull() .hasSize(2) .extracting("type", "level", "description", "content") .contains(Assertions.tuple(URI.create("http: Assertions.tuple(URI.create("http: }