@Test
public void shouldGracefullyHandleProtocolExceptionForInvalidMethod() throws Throwable {

  doThrow(ProtocolException.class).when(mockHttpURLConnection).setRequestMethod(anyString());
  assertThat(httpFunction().apply(HTTP_DELETE_REQUEST).getFailure(),
      instanceOf(ProtocolException.class));
  verify(mockHttpURLConnection).disconnect();
}