@Test
public void extractMethodFailForNettyRequest() throws Exception {

  String[][] mm = {
      { "POST", "bla", null },
      { "POST", "PUT", "PATCH" },
      { "OPTIONS", null, null }
  };
  for (String[] m : mm) {
    HttpRequest hr = mock(HttpRequest.class);
    io.netty.handler.codec.http.HttpMethod hm = mock(io.netty.handler.codec.http.HttpMethod.class);
    when(hr.method()).thenReturn(hm);
    when(hm.name()).thenReturn(m[0]);
    HttpHeaders hh = mock(HttpHeaders.class);
    when(hr.headers()).thenReturn(hh);
    when(hh.get("X-HTTP-Method")).thenReturn(m[1]);
    when(hh.get("X-HTTP-Method-Override")).thenReturn(m[2]);
    try {
      ODataNettyHandlerImpl.extractMethod(hr);
      fail();
    } catch (ODataLibraryException e) {
      // expected
    }
  }
}