@Test
public void taskStatus() {

    Worker worker = null;
    ConnectorTaskId taskId = new ConnectorTaskId("connector", 0);
    String workerId = "workerId";
    ConfigBackingStore configStore = strictMock(ConfigBackingStore.class);
    StatusBackingStore statusStore = strictMock(StatusBackingStore.class);
    AbstractHerder herder = partialMockBuilder(AbstractHerder.class)
            .withConstructor(Worker.class, String.class, StatusBackingStore.class, ConfigBackingStore.class)
            .withArgs(worker, workerId, statusStore, configStore)
            .addMockedMethod("generation")
            .createMock();
    EasyMock.expect(herder.generation()).andStubReturn(5);
    final Capture<TaskStatus> statusCapture = EasyMock.newCapture();
    statusStore.putSafe(EasyMock.capture(statusCapture));
    EasyMock.expectLastCall();
    EasyMock.expect(statusStore.get(taskId)).andAnswer(new IAnswer<TaskStatus>() {
        @Override
        public TaskStatus answer() throws Throwable {
            return statusCapture.getValue();
        }
    });
    replayAll();
    herder.onFailure(taskId, new RuntimeException());
    ConnectorStateInfo.TaskState taskState = herder.taskStatus(taskId);
    assertEquals(workerId, taskState.workerId());
    assertEquals("FAILED", taskState.state());
    assertEquals(0, taskState.id());
    assertNotNull(taskState.trace());
    verifyAll();
}