@Test
public void shouldSendCursorsForLockedPartitions() throws IOException {

    final Request request = mock(Request.class);
    when(request.execute()).thenThrow(new IOException("Initial connection failed"));
    final Headers headers = new HeadersImpl();
    when(request.getHeaders()).thenReturn(headers);
    when(RequestFactory.createRequest(uri, "GET")).thenReturn(request);
    final NoBackoffStrategy backoffStrategy = new NoBackoffStrategy();
    when(cursorManager.getCursors(EVENT_NAME)).thenReturn(asList(new Cursor("0", "0"), new Cursor("1", "10"), new Cursor("2", "20"), new Cursor("3", "30")));
    final Lock lock = new Lock(EVENT_NAME, "test", asList(new Partition("0", "0", "100"), new Partition("1", "0", "100")));
    final NakadiReader<SomeEvent> nakadiReader = new NakadiReader<>(uri, RequestFactory, backoffStrategy, cursorManager, objectMapper, Collections.singleton(EVENT_NAME), Optional.empty(), Optional.of(lock), SomeEvent.class, listener);
    expectedException.expect(IOException.class);
    expectedException.expectMessage(equalTo("Initial connection failed"));
    nakadiReader.run();
    assertEquals(singletonList("[{\"partition\":\"0\",\"offset\":\"0\"},{\"partition\":\"1\",\"offset\":\"10\"}"), headers.get("X-Nakadi-Cursors"));
}