@Test
public void shouldThrowOnNonSuccessHttpResponses() throws Exception {

  httpResponseBuilder =
      new HttpResponseBuilder().setStatusCode(HttpStatusCodes.STATUS_CODE_NO_CONTENT);
  KeysDownloader instance = newInstanceForTests();
  try {
    instance.download();
    fail();
  } catch (IOException expected) {
    assertTrue(
        "Message "
            + expected.getMessage()
            + " should contain "
            + HttpStatusCodes.STATUS_CODE_NO_CONTENT,
        expected.getMessage().contains(Integer.toString(HttpStatusCodes.STATUS_CODE_NO_CONTENT)));
  }
}