@Test
void cleanup() {

    var state = new ClusterStateResponse();
    state.metadata = new ClusterStateResponse.Metadata();
    state.metadata.indices = Map.of("action-2017.10.01", index(ClusterStateResponse.IndexState.OPEN),
            "action-2017.10.30", index(ClusterStateResponse.IndexState.CLOSE),
            "action-2017.11.01", index(ClusterStateResponse.IndexState.OPEN));
    when(elasticSearch.state()).thenReturn(state);
    job.cleanup(LocalDate.of(2017, 11, 8));
    verify(elasticSearch).deleteIndex("action-2017.10.01");
    verify(elasticSearch).closeIndex("action-2017.11.01");
}