### Question:
Swagger2Feature extends AbstractSwaggerFeature<Swagger2Feature.Portable> implements SwaggerUiSupport, SwaggerProperties { @Override public void setBasePathByAddress(String address) { delegate.setBasePathByAddress(address); } Swagger2Feature(); @Override void calculateDefaultBasePath(Server server); @Override void addSwaggerResource(Server server, Bus bus); void initBeanConfig(BeanConfig beanConfig, Properties props); Boolean isUsePathBasedConfig(); void setUsePathBasedConfig(Boolean usePathBasedConfig); String getHost(); void setHost(String host); String[] getSchemes(); void setSchemes(String[] schemes); Boolean isPrettyPrint(); void setPrettyPrint(Boolean prettyPrint); Swagger2Customizer getCustomizer(); void setCustomizer(Swagger2Customizer customizer); boolean isScanAllResources(); void setScanAllResources(boolean scanAllResources); String getIgnoreRoutes(); void setIgnoreRoutes(String ignoreRoutes); @Override void setBasePathByAddress(String address); void setSwaggerUiMavenGroupAndArtifact(String swaggerUiMavenGroupAndArtifact); void setSwaggerUiVersion(String swaggerUiVersion); void setSupportSwaggerUi(boolean supportSwaggerUi); @Override Boolean isSupportSwaggerUi(); void setSwaggerUiMediaTypes(Map<String, String> swaggerUiMediaTypes); @Override Map<String, String> getSwaggerUiMediaTypes(); void setSecurityDefinitions(Map<String, SecuritySchemeDefinition> securityDefinitions); String getPropertiesLocation(); void setPropertiesLocation(String propertiesLocation); boolean isScan(); void setScan(boolean scan); void setSwaggerUiConfig(SwaggerUiConfig swaggerUiConfig); @Override SwaggerUiConfig getSwaggerUiConfig(); @Override String findSwaggerUiRoot();  }### Answer:
@Test public void testSetBasePathByAddress() { Swagger2Feature f = new Swagger2Feature(); f.setBasePathByAddress("http: assertEquals("/foo", f.getBasePath()); assertEquals("localhost:8080", f.getHost()); unsetBasePath(f); f.setBasePathByAddress("http: assertEquals("/foo", f.getBasePath()); assertEquals("localhost", f.getHost()); unsetBasePath(f); f.setBasePathByAddress("/foo"); assertEquals("/foo", f.getBasePath()); assertNull(f.getHost()); unsetBasePath(f); }