### Question:
InMemoryAlertManager implements AlertManager { @Override public <C extends Serializable> Alert create(URI type,String subtype, Alert.Level level, String description, C content) { GenericAlert alert = new GenericAlert(type, subtype,level, description, content); DateTime createdTime = alert.getEvents().get(0).getChangeTime(); addAlert(alert, createdTime); return alert; } 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 testCreate() { URI type = URI.create("urn:alert:test"); Alert alert = this.manager.create(type, "subtype", Alert.Level.INFO, "test", "content"); assertThat(alert.getType()).isEqualTo(type); assertThat(alert.getLevel()).isEqualTo(Alert.Level.INFO); assertThat(alert.getDescription()).isEqualTo("test"); assertThat((String) alert.getContent()).isEqualTo("content"); }
@Test public void testNotifyRecieverCreate() { this.manager.create(URI.create("urn:alert:test1"), "subtype",Alert.Level.INFO, "test1", "created"); verify(this.receiver, times(1)).alertsAvailable(any(Integer.class)); }