@Test
public void testAuthenticationFailure() {

  when(authenticator.authenticate(any())).thenReturn(null);
  final Request request = Request.forUri("/", "PUT")
      .withHeader(HttpHeaders.AUTHORIZATION, "Bearer token")
      .withPayload(ByteString.encodeUtf8("hello"));
  try {
    sut.authenticate(request);
    fail();
  } catch (ResponseException e) {
    assertThat(e.getResponse().status(), is(
        Status.UNAUTHORIZED
            .withReasonPhrase("Authorization token is invalid")));
  }
}