ElasticsearchMetaAlertDao implements MetaAlertDao { @Override public Document update(Document update, Optional<String> index) throws IOException { return metaAlertUpdateDao.update(update, index); } ElasticsearchMetaAlertDao(IndexDao indexDao);  ElasticsearchMetaAlertDao(IndexDao indexDao, String metaAlertsIndex,
      String threatSort);  ElasticsearchMetaAlertDao(); @Override void init(IndexDao indexDao, Optional<String> threatSort); @Override void init(AccessConfig config); @Override Map<String, FieldType> getColumnMetadata(List<String> indices); @Override Document getLatest(String guid, String sensorType); @Override Iterable<Document> getAllLatest(List<GetRequest> getRequests); @Override SearchResponse getAllMetaAlertsForAlert(String guid); @Override Document createMetaAlert(MetaAlertCreateRequest request); @Override Document addAlertsToMetaAlert(String metaAlertGuid, List<GetRequest> alertRequests); @Override Document removeAlertsFromMetaAlert(String metaAlertGuid, List<GetRequest> alertRequests); @Override Document updateMetaAlertStatus(String metaAlertGuid, MetaAlertStatus status); @Override SearchResponse search(SearchRequest searchRequest); @Override GroupResponse group(GroupRequest groupRequest); @Override Document update(Document update, Optional<String> index); @Override Map<Document, Optional<String>> batchUpdate(Map<Document, Optional<String>> updates); @Override Document addCommentToAlert(CommentAddRemoveRequest request); @Override Document removeCommentFromAlert(CommentAddRemoveRequest request); @Override Document addCommentToAlert(CommentAddRemoveRequest request, Document latest); @Override Document removeCommentFromAlert(CommentAddRemoveRequest request, Document latest); @Override Document patch(RetrieveLatestDao retrieveLatestDao, PatchRequest request,
      Optional<Long> timestamp); void setPageSize(int pageSize); static final String THREAT_TRIAGE_FIELD; static final String METAALERTS_INDEX; static final String SOURCE_TYPE_FIELD; }
@Test public void testUpdateShouldThrowExceptionOnMissingSensorIndex() throws Exception { ElasticsearchDao elasticsearchDao = mock(ElasticsearchDao.class); ElasticsearchMetaAlertRetrieveLatestDao elasticsearchMetaAlertRetrieveLatestDao = mock(ElasticsearchMetaAlertRetrieveLatestDao.class); MetaAlertConfig metaAlertConfig = mock(MetaAlertConfig.class); ElasticsearchMetaAlertUpdateDao emauDao = spy(new ElasticsearchMetaAlertUpdateDao(elasticsearchDao, elasticsearchMetaAlertRetrieveLatestDao, metaAlertConfig, 1)); doThrow(new IndexNotFoundException("bro")).when(emauDao).getMetaAlertsForAlert("alert_one"); Document update = new Document(new HashMap<>(), "alert_one", "", 0L); assertThrows(IndexNotFoundException.class, () -> emauDao.update(update, Optional.empty())); }