@Test
public void partitionsAssignedCannotFetchOffset() throws IOException {

    final Consumer<Long, String> consumer = mock(Consumer.class);
    final PartitionedWriter successfulWriter = mock(PartitionedWriter.class);
    final PartitionedWriter exceptionalWriter = mock(PartitionedWriter.class);
    final OffsetResetter offsetResetter = new OffsetResetter<>(consumer, mock(java.util.function.Consumer.class),
            Arrays.asList(successfulWriter, exceptionalWriter));
    final TopicPartition partition = new TopicPartition(TOPIC, 1);
    final List<TopicPartition> partitions = Collections.singletonList(partition);
    when(successfulWriter.getStartingOffsets(any())).thenReturn(new HashMap<>());
    when(exceptionalWriter.getStartingOffsets(any())).thenThrow(new IOException("Ayo"));
    offsetResetter.onPartitionsAssigned(partitions);
    verify(consumer, times(1)).seekToBeginning(Collections.singleton(partition));
    verifyNoMoreInteractions(consumer);
}