### Question:
HttpsRequestCustomizer implements HttpConfiguration.Customizer { @Override public void customize( Connector connector, HttpConfiguration channelConfig, Request request ) { request.setScheme( HttpScheme.HTTPS.asString() ); addResponseFieldIfConfigured( request, hstsResponseField ); } HttpsRequestCustomizer( Config config ); @Override void customize( Connector connector, HttpConfiguration channelConfig, Request request );  }### Answer:
@Test public void shouldSetRequestSchemeToHttps() { Customizer customizer = newCustomizer(); Request request = mock( Request.class ); customize( customizer, request ); verify( request ).setScheme( HTTPS.asString() ); }
@Test public void shouldAddHstsHeaderWhenConfigured() { String configuredValue = "max-age=3600; includeSubDomains"; Customizer customizer = newCustomizer( configuredValue ); Request request = newRequest(); customize( customizer, request ); String receivedValue = request.getResponse().getHttpFields().get( STRICT_TRANSPORT_SECURITY ); assertEquals( configuredValue, receivedValue ); }
@Test public void shouldNotAddHstsHeaderWhenNotConfigured() { Customizer customizer = newCustomizer(); Request request = newRequest(); customize( customizer, request ); String hstsValue = request.getResponse().getHttpFields().get( STRICT_TRANSPORT_SECURITY ); assertNull( hstsValue ); }