### Question:
Function { @FunctionName("hello") public HttpResponseMessage<String> hello( @HttpTrigger(name = "req", methods = { "get", "post" }, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request, final ExecutionContext context) { context.getLogger().info("Java HTTP trigger processed a request."); String query = request.getQueryParameters().get("name"); String name = request.getBody().orElse(query); if (name == null) { return request.createResponse(400, "Please pass a name on the query string or in the request body"); } else { return request.createResponse(200, "Hello, " + name); } }  @FunctionName("hello") HttpResponseMessage<String> hello(
			@HttpTrigger(name = "req", methods = { "get",
					"post" }, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
			final ExecutionContext context);  }### Answer:
@Test public void testHello() throws Exception { final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class); final Map<String, String> queryParams = new HashMap<>(); queryParams.put("name", "Azure"); doReturn(queryParams).when(req).getQueryParameters(); final Optional<String> queryBody = Optional.empty(); doReturn(queryBody).when(req).getBody(); final HttpResponseMessage res = mock(HttpResponseMessage.class); doReturn(res).when(req).createResponse(anyInt(), anyString()); final ExecutionContext context = mock(ExecutionContext.class); doReturn(Logger.getGlobal()).when(context).getLogger(); final HttpResponseMessage ret = new Function().hello(req, context); assertSame(res, ret); }