function.setContext(request);
expect(response.getStatusCode()).andReturn(200).atLeastOnce();
expect(response.getFirstHeaderOrNull(CONTENT_TYPE)).andReturn("text/plain");
expect(response.getFirstHeaderOrNull(LOCATION)).andReturn("path");
expect(response.getPayload()).andReturn(payload).atLeastOnce();
payload.release();
replay(payload);
replay(response);
assertEquals(function.apply(response), URI.create("http://new:8080/path"));
verify(response);