@Test
public void testRefreshOffsetNotCoordinatorForConsumer() {

    client.prepareResponse(consumerMetadataResponse(node, Errors.NONE.code()));
    coordinator.ensureCoordinatorReady();
    subscriptions.assignFromUser(Arrays.asList(tp));
    subscriptions.needRefreshCommits();
    client.prepareResponse(offsetFetchResponse(tp, Errors.NOT_COORDINATOR_FOR_GROUP.code(), "", 100L));
    client.prepareResponse(consumerMetadataResponse(node, Errors.NONE.code()));
    client.prepareResponse(offsetFetchResponse(tp, Errors.NONE.code(), "", 100L));
    coordinator.refreshCommittedOffsetsIfNeeded();
    assertFalse(subscriptions.refreshCommitsNeeded());
    assertEquals(100L, subscriptions.committed(tp).offset());
}