### Question:
PortCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { if (factory.getPort() >= 0) { options.setPort(factory.getPort()); } return options; } PortCustomizer(AbstractConfigurableWebServerFactory factory); @Override HttpServerOptions apply(HttpServerOptions options);  }### Answer:
@Test public void shouldSetValidPort() { given(mockFactory.getPort()).willReturn(1); PortCustomizer customizer = new PortCustomizer(mockFactory); customizer.apply(mockHttpServerOptions); verify(mockHttpServerOptions).setPort(1); }
@Test public void shouldIgnoreInvalidPort() { given(mockFactory.getPort()).willReturn(-1); PortCustomizer customizer = new PortCustomizer(mockFactory); customizer.apply(mockHttpServerOptions); verify(mockHttpServerOptions, times(0)).setPort(anyInt()); }