@Test
public void shouldReturnRedirectWithLocationWhenNotLeaderExceptionIsThrownAndTheLeaderIsSetToAValidLeader() {

    when(distributedStore.getAll()).thenReturn(Futures.<Collection<KeyValue>>immediateFailedFuture(new NotLeaderException(self, leader)));
    ClientResponse response = getClientResponseForUnsuccessfulRequest();
    assertThat(response.getClientResponseStatus(), equalTo(ClientResponse.Status.MOVED_PERMANENTLY));
    assertThat(response.getLocation().toString(), equalTo(leaderUrl + REQUEST_URI));
}