@Test
public void invalidMethod() throws URISyntaxException, IOException, ParseException {

    HttpExchange exchange = prepareExchange("http://localhost:8080/");
    // Simple GET method
    expect(exchange.getRequestMethod()).andReturn("PUT");
    Headers header = new Headers();
    ByteArrayOutputStream out = prepareResponse(handler, exchange, header);
    handler.doHandle(exchange);
    JSONObject resp = (JSONObject) new JSONParser().parse(out.toString());
    assertTrue(resp.containsKey("error"));
    assertEquals(resp.get("error_type"), IllegalArgumentException.class.getName());
    assertTrue(((String) resp.get("error")).contains("PUT"));
}