AbstractLuceneMetaAlertUpdateDao implements MetaAlertUpdateDao { protected void update(Map<Document, Optional<String>> updates) throws IOException { if (updates.size() == 1) { Entry<Document, Optional<String>> singleUpdate = updates.entrySet().iterator().next(); updateDao.update(singleUpdate.getKey(), singleUpdate.getValue()); } else if (updates.size() > 1) { updateDao.batchUpdate(updates); } } protected  AbstractLuceneMetaAlertUpdateDao(
      UpdateDao updateDao,
      MetaAlertRetrieveLatestDao retrieveLatestDao,
      MetaAlertConfig config); UpdateDao getUpdateDao(); MetaAlertRetrieveLatestDao getRetrieveLatestDao(); MetaAlertConfig getConfig(); @Override Document patch(RetrieveLatestDao retrieveLatestDao, PatchRequest request,
      Optional<Long> timestamp); @Override Map<Document, Optional<String>> batchUpdate(Map<Document, Optional<String>> updates); @Override Document addAlertsToMetaAlert(String metaAlertGuid, List<GetRequest> alertRequests); @Override @SuppressWarnings("unchecked") Document removeAlertsFromMetaAlert(String metaAlertGuid, List<GetRequest> alertRequests); @Override Document updateMetaAlertStatus(String metaAlertGuid, MetaAlertStatus status);  }
@Test public void testUpdateSingle() throws IOException { Map<Document, Optional<String>> updates = new HashMap<>(); Document document = new Document(new HashMap<>(), "guid", "sensor", 0L); updates.put(document, Optional.empty()); dao.update(updates); verify(indexDao, times(1)).update(document, Optional.empty()); }