Source:
public void createApiWithValidOAS3DocumentAsYAMLFile() throws Exception { swagger_file = new File(resourceLocation + File.separator + "swaggerFiles/OAS3Document.yaml"); apiRequest = new APIRequest(import_definition_file, swagger_file.getAbsolutePath(), "", type); HttpResponse designResponse1 = apiPublisher.designAPIWithOAS(apiRequest); Assert.assertTrue(designResponse1.getData().contains("imported")); String payload = readFromFile(swagger_file.getAbsolutePath()); Yaml yaml = new Yaml(); Map<String, Object> map = (Map<String, Object>) yaml.load(payload); JSONObject json = new JSONObject(map); String apiName = json.getJSONObject("info").get("title").toString(); String apiContext = json.get("basePath").toString(); String apiVersion = json.getJSONObject("info").get("version").toString(); String payloadJson = json.toString(); apiRequest = new APIRequest(apiName, apiContext, apiVersion); apiRequest.setSwagger(payloadJson); HttpResponse designResponse2 = apiPublisher.designAPI(apiRequest); verifyResponse(designResponse2); String name = (new JSONObject(designResponse2.getData())).getJSONObject("data").get("apiName").toString(); String version = (new JSONObject(designResponse2.getData())).getJSONObject("data").get("version").toString(); Assert.assertEquals(name, apiName); Assert.assertEquals(version, apiVersion); HttpResponse getResponse = apiPublisher.getAPI(apiName, "admin", apiVersion); String resource = (new JSONObject(getResponse.getData())).getJSONObject("api").get("resources").toString(); Assert.assertTrue(resource != "null", "API resource was not imported correctly"); }

Target:
public void createApiWithValidOAS3DocumentAsYAMLFile() throws Exception { swagger_file = new File(resourceLocation + File.separator + "swaggerFiles/OAS3Document.yaml"); apiRequest = new APIRequest(import_definition_file, swagger_file.getAbsolutePath(), "", type); HttpResponse designResponse1 = apiPublisher.designAPIWithOAS(apiRequest); Assert.assertTrue(designResponse1.getData().contains("imported")); String payload = readFromFile(swagger_file.getAbsolutePath()); Yaml yaml = new Yaml(); Map<String, Object> map = (Map<String, Object>) yaml.load(payload); JSONObject json = new JSONObject(map); String apiName = json.getJSONObject("info").get("title").toString(); String apiContext = json.get("basePath").toString(); String apiVersion = json.getJSONObject("info").get("version").toString(); String payloadJson = json.toString(); apiRequest = new APIRequest(apiName, apiContext, apiVersion); apiRequest.setSwagger(payloadJson); HttpResponse designResponse2 = apiPublisher.designAPI(apiRequest); verifyResponse(designResponse2); String name = (new JSONObject(designResponse2.getData())).getJSONObject("data").get("apiName").toString(); String version = (new JSONObject(designResponse2.getData())).getJSONObject("data").get("version").toString(); Assert.assertEquals(name, apiName, "Api name was not imported correctly"); Assert.assertEquals(version, apiVersion, "Api version was not imported correctly"); HttpResponse getResponse = apiPublisher.getAPI(apiName, "admin", apiVersion); String resource = (new JSONObject(getResponse.getData())).getJSONObject("api").get("resources").toString(); Assert.assertTrue(resource != "null", "API resource was not imported correctly"); }