### Question:
SubstituteSwaggerGenerator { public String generateSubstituteSwaggerForService(InstanceInfo service, ApiInfo api, String gatewayScheme, String gatewayHost) { String title = service.getMetadata().get(SERVICE_TITLE); String description = service.getMetadata().get(SERVICE_DESCRIPTION); String basePath = (api.getGatewayUrl().startsWith("/") ? "" : "/") + api.getGatewayUrl() + (api.getGatewayUrl().endsWith("/") ? "" : "/") + service.getAppName().toLowerCase(); Template t = ve.getTemplate("substitute_swagger.json"); VelocityContext context = new VelocityContext(); context.put("title", title); context.put("description", description); context.put("version", api.getVersion()); context.put("scheme", gatewayScheme); context.put("host", gatewayHost); context.put("basePath", basePath); context.put("documentationUrl", api.getDocumentationUrl()); StringWriter w = new StringWriter(); t.merge(context, w); return w.toString(); } SubstituteSwaggerGenerator(); String generateSubstituteSwaggerForService(InstanceInfo service,
                                                      ApiInfo api,
                                                      String gatewayScheme, String gatewayHost);  }### Answer:
@Test public void testParseApiInfo() { String gatewayScheme = "https"; String gatewayHost = "localhost:8080"; Map<String, String> metadata = new HashMap<>(); metadata.put(API_INFO + ".1." + API_INFO_GATEWAY_URL, "api/v1"); metadata.put(API_INFO + ".1." + API_INFO_DOCUMENTATION_URL, "https: List<ApiInfo> info = new EurekaMetadataParser().parseApiInfo(metadata); InstanceInfo service = InstanceInfo.Builder.newBuilder().setAppName("serviceId").setHostName("localhost") .setSecurePort(8080).enablePort(PortType.SECURE, true).setMetadata(metadata).build(); String result = new SubstituteSwaggerGenerator().generateSubstituteSwaggerForService(service, info.get(0), gatewayScheme, gatewayHost); assertTrue(result.contains("https: }