public void flush() {
        stateMgr.flushCache();
        recordCollector.flush();
    }
@Test
    public void shouldFlushStateManagerAndRecordCollector() {
        when(stateManager.taskId()).thenReturn(taskId);
        when(stateManager.taskType()).thenReturn(TaskType.ACTIVE);
        task = createStatefulTask(createConfig("100"), false);

        task.flush();

        verify(stateManager).flushCache();
        verify(recordCollector).flush();
    }