reta commented on code in PR #982:
URL: https://github.com/apache/cxf/pull/982#discussion_r945298926
##########
osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java:
##########
@@ -99,6 +112,41 @@ public void testJaxRsPut() throws Exception {
assertStatus(Status.OK, response);
}
+ @Test
+ public void testGetSwaggerUi() {
+ WebTarget swaggerWt = ClientBuilder.newClient().target(SWAGGER_URL)
+ .queryParam("url", "/cxf/jaxrs/openapi.json");
+ Response response = swaggerWt.request().get();
+ String swaggerFileHtml = readResponseAsString(response);
+
+ assertStatus(Status.OK, response);
+ assertTrue(swaggerFileHtml.contains("<html"));
+ assertTrue(swaggerFileHtml.contains("<head>"));
+ assertTrue(swaggerFileHtml.contains("<title>Swagger UI</title>"));
+ assertTrue(swaggerFileHtml.contains("</html>"));
+ }
+
+ @Test
+ public void testGetOpenApiJsonFile() {
+ WebTarget openApiWt =
ClientBuilder.newClient().target(OPEN_API_FILE_URL);
+ Response response = openApiWt.request().get();
+ String openApiJson = readResponseAsString(response);
+
+ try {
+ new ObjectMapper().readValue(openApiJson, Object.class);
+ assertTrue(openApiJson.contains("/bookstore/"));
+ } catch (JsonProcessingException e) {
+ fail();
+ }
+ }
+
+ private String readResponseAsString(Response response) {
Review Comment:
This is not necessary, you could just use
`response.readEntity(String.class)` directly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]