### Question:
HttpMethodFilteringHandler implements WebServiceHandler { @Override public Eventual<HttpResponse> handle(HttpRequest request, HttpInterceptor.Context context) { if (!method.equals(request.method())) { return Eventual.of( HttpResponse.response(METHOD_NOT_ALLOWED) .body(errorBody, StandardCharsets.UTF_8) .build() ); } return httpHandler.handle(request, context); } HttpMethodFilteringHandler(HttpMethod method, WebServiceHandler httpHandler); @Override Eventual<HttpResponse> handle(HttpRequest request, HttpInterceptor.Context context);  }### Answer:
@Test public void delegatesTheRequestIfRequestMethodIsSupported() { WebServiceHandler handler = mock(WebServiceHandler.class); HttpMethodFilteringHandler post = new HttpMethodFilteringHandler(POST, handler); HttpRequest request = post("/some-uri").build(); post.handle(request, mock(HttpInterceptor.Context.class)); verify(handler).handle(eq(request), any(HttpInterceptor.Context.class)); }
@Test public void failsIfRequestMethodIsNotSupported() throws Exception { WebServiceHandler handler = mock(WebServiceHandler.class); HttpMethodFilteringHandler post = new HttpMethodFilteringHandler(GET, handler); HttpRequest request = post("/some-uri").build(); HttpResponse response = Mono.from(post.handle(request, requestContext())).block(); assertThat(response.status(), is(METHOD_NOT_ALLOWED)); }