### Question:
OpenApiParser { public Result parse() throws ParsingException { final ParseOptions options = new ParseOptions(); options.setResolve(false); final SwaggerParseResult result = new OpenAPIV3Parser().readContents(readOpenAPIDescription(), null, options); validate(result); String baseUrl = Optional.ofNullable(result.getOpenAPI().getServers()) .flatMap(s -> s.stream().findFirst()) .map(Server::getUrl) .orElse(""); if (!baseUrl.contains("{")) { baseUrl = openApiUrl.resolve(baseUrl).toString(); } final List<Operation> operations; if (result.getOpenAPI().getPaths() == null) { operations = Collections.emptyList(); } else { operations = new ArrayList<>(); result.getOpenAPI().getPaths().forEach((path, item) -> item.readOperationsMap().forEach((method, operation) -> operations.add(new Operation(method.name(), path.replaceAll("\\{[^/]*}", "*"))))); } return new Result(baseUrl, operations, result.getMessages()); } OpenApiParser(String openApiUrl); Result parse();  }### Answer:
@Test public void shouldParseOpenApiYaml() throws OpenApiParser.ParsingException { URL url = getClass().getResource("/valid.yaml"); final OpenApiParser.Result result = new TestOpenApiParser(url.toString()).parse(); Assert.assertFalse(result.hasWarnings()); Assert.assertEquals("https: }
@Test public void shouldHaveWarnings() throws OpenApiParser.ParsingException { URL url = getClass().getResource("/warnings.yml"); final OpenApiParser.Result result = new TestOpenApiParser(url.toString()).parse(); Assert.assertTrue(result.hasWarnings()); Assert.assertEquals("https: }
@Test public void shouldParseOpenApiJson() throws OpenApiParser.ParsingException { URL url = getClass().getResource("/valid.json"); final OpenApiParser.Result result = new TestOpenApiParser(url.toString()).parse(); Assert.assertFalse(result.hasWarnings()); Assert.assertEquals("https: }
@Test(expected = OpenApiParser.ParsingException.class) public void shouldFailIfInvalidProtocol() throws OpenApiParser.ParsingException { URL url = getClass().getResource("/valid.json"); final OpenApiParser.Result result = new OpenApiParser(url.toString()).parse(); }