EntityManagerService { public void deleteEntity(String entity) throws IOException { String entityFileName = entity + ENTITY_FILE_EXTENSION; File entitiesFile = hubConfig.getHubEntitiesDir().resolve(entityFileName).toFile(); if (entitiesFile.exists()) { em.deleteEntity(entity); dataHubService.deleteDocument("/entities/" + entityFileName, DatabaseKind.STAGING); dataHubService.deleteDocument("/entities/" + entityFileName, DatabaseKind.FINAL); } }  List<EntityModel> getLegacyEntities(); List<EntityModel> getEntities(); EntityModel createEntity(EntityModel newEntity); EntityModel saveEntity(EntityModel entity); void deleteEntity(String entity); void deploySearchOptions(); void saveDbIndexes(); void savePii(); void saveAllUiData(List<EntityModel> entities); void saveEntityUiData(EntityModel entity); EntityModel getEntity(String entityName); EntityModel getEntity(String entityName, Boolean extendSubEntities); FlowModel getFlow(String entityName, FlowType flowType, String flowName); FlowModel createFlow(String entityName, FlowType flowType, FlowModel newFlow); void deleteFlow(String entityName, String flowName, FlowType flowType); JsonNode validatePlugin(
        HubConfig config,
        String entityName,
        String flowName,
        PluginModel plugin
    ); void saveFlowPlugin(
        PluginModel plugin
    ); static final String ENTITY_FILE_EXTENSION; }
@Test public void deleteEntity() throws IOException, InterruptedException { List<EntityModel> entities = entityMgrService.getEntities(); assertEquals(1, entities.size()); entityMgrService.deleteEntity(ENTITY); entities = entityMgrService.getEntities(); assertEquals(0, entities.size()); Thread.sleep(1000); DocumentPage doc = finalDocMgr.read("/entities/" + ENTITY + ".entity.json"); assertFalse(doc.hasNext()); doc = stagingDocMgr.read("/entities/" + ENTITY + ".entity.json"); assertFalse(doc.hasNext()); }