### Question:
RestAnnotationProcessor implements Function<Invocation, HttpRequest> { @VisibleForTesting static URI addHostIfMissing(URI original, URI withHost) { checkNotNull(withHost, "URI withHost cannot be null"); checkArgument(withHost.getHost() != null, "URI withHost must have host:" + withHost); if (original == null) return null; if (original.getHost() != null) return original; String host = withHost.toString(); URI baseURI = host.endsWith("/") ? withHost : URI.create(host + "/"); return baseURI.resolve(original); } @Inject private  RestAnnotationProcessor(Injector injector,
         @Provider Supplier<Credentials> credentials, @ApiVersion String apiVersion, @BuildVersion String buildVersion,
         HttpUtils utils, ContentMetadataCodec contentMetadataCodec, InputParamValidator inputParamValidator,
         GetAcceptHeaders getAcceptHeaders, @Nullable @Named("caller") Invocation caller,
         @Named(Constants.PROPERTY_STRIP_EXPECT_HEADER) boolean stripExpectHeader,
         @Named(Constants.PROPERTY_CONNECTION_CLOSE_HEADER) boolean connectionCloseHeader); @Deprecated GeneratedHttpRequest createRequest(Invokable<?, ?> invokable, List<Object> args); @Override GeneratedHttpRequest apply(Invocation invocation); @Override String toString();  }### Answer:
@Test(expectedExceptions = NullPointerException.class) public void testAddHostNullWithHost() throws Exception { assertNull(RestAnnotationProcessor.addHostIfMissing(null, null)); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddHostWithHostHasNoHost() throws Exception { assertNull(RestAnnotationProcessor.addHostIfMissing(null, new URI("/no/host"))); }
@Test public void testAddHostNullOriginal() throws Exception { assertNull(RestAnnotationProcessor.addHostIfMissing(null, new URI("http: }
@Test public void testAddHostOriginalHasHost() throws Exception { URI original = new URI("http: URI result = RestAnnotationProcessor.addHostIfMissing(original, new URI("http: assertEquals(original, result); }
@Test public void testAddHostIfMissing() throws Exception { URI result = RestAnnotationProcessor.addHostIfMissing(new URI("/bar"), new URI("http: assertEquals(new URI("http: }
@Test public void testComplexHost() throws Exception { URI result = RestAnnotationProcessor.addHostIfMissing(new URI("bar"), new URI("http: assertEquals(new URI("http: }