### Question:
InMemoryAlertManager implements AlertManager { @Override public boolean addDescriptor(AlertDescriptor descriptor) { return this.descriptors.add(descriptor); } InMemoryAlertManager(); @Override ID getId(); void setReceiversExecutor(Executor receiversExecutor); @Override Set<AlertDescriptor> getAlertDescriptors(); void setAlertDescriptors(Collection<AlertDescriptor> types); @Override void updateLastUpdatedTime(); @Override boolean addDescriptor(AlertDescriptor descriptor); @Override void addReceiver(AlertNotifyReceiver receiver); @Override void removeReceiver(AlertNotifyReceiver receiver); @Override Optional<Alert> getAlert(Alert.ID id); @Override Optional<Alert> getAlertAsServiceAccount(Alert.ID id); @Override AlertCriteria criteria(); @Override Alert.ID resolve(Serializable ser); @Override Iterator<Alert> getAlerts(AlertCriteria criteria); @Override Iterator<AlertSummary> getAlertsSummary(AlertCriteria criteria); @Override Alert create(URI type,String subtype, Alert.Level level, String description, C content); @Override Alert createEntityAlert(URI type, Alert.Level level, String description, EntityIdentificationAlertContent<C> content); @Override AlertResponse getResponse(Alert alert); @Override Alert remove(Alert.ID id); @Override Long getLastUpdatedTime(); @Override EntityIdentificationAlertContent createEntityIdentificationAlertContent(String entityId, SecurityRole.ENTITY_TYPE entityType, C content); static final int MAX_ALERTS; }### Answer:
@Test public void testAddDescriptor() { URI type = URI.create("urn:alert:test"); Map<Alert.State, String> states = new HashMap<>(); states.put(Alert.State.UNHANDLED, "application/json"); states.put(Alert.State.HANDLED, "application/json"); AlertDescriptor descr = new AlertDescriptor(URI.create("urn:alert:test"), "application/json", "description", true, states); assertThat(this.manager.addDescriptor(descr)).isTrue(); Set<AlertDescriptor> descrSet = this.manager.getAlertDescriptors(); assertThat(descrSet).hasSize(1).extracting("alertType").contains(type); assertThat(descrSet).extracting("contentType").contains("application/json"); assertThat(descrSet).extracting("description").contains("description"); assertThat(descrSet).extracting("respondable").contains(true); }