### Question:
AddressCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { InetAddress address = factory.getAddress(); if (address != null && address.getHostAddress() != null) { options.setHost(address.getHostAddress()); } return options; } AddressCustomizer(AbstractConfigurableWebServerFactory factory); @Override HttpServerOptions apply(HttpServerOptions options);  }### Answer:
@Test public void shouldSetValidAddress() throws UnknownHostException { given(mockFactory.getAddress()).willReturn(InetAddress.getByName("localhost")); AddressCustomizer customizer = new AddressCustomizer(mockFactory); customizer.apply(mockHttpServerOptions); verify(mockHttpServerOptions).setHost("127.0.0.1"); }
@Test public void shouldIgnoreInvalidAddress() { AddressCustomizer customizer = new AddressCustomizer(mockFactory); customizer.apply(mockHttpServerOptions); verify(mockHttpServerOptions, times(0)).setHost(anyString()); }