diff options
Diffstat (limited to 'juick-server/src/test/java/com/juick/server/tests')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 66845cfa..13cb8d41 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -1651,4 +1651,16 @@ public class ServerTests { String sql = String.format("SELECT * FROM table WHERE data='%s'", Utils.encodeSphinx("';-- DROP TABLE table")); assertThat(sql, is("SELECT * FROM table WHERE data='\\';-- DROP TABLE table\'")); } + @Test + public void swaggerOutput() throws Exception { + MvcResult result = mockMvc.perform(get("/v2/api-docs") + .accept(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()) + .andReturn(); + String outputDir = System.getProperty("io.springfox.staticdocs.outputDir"); + Files.createDirectories(Paths.get(outputDir)); + BufferedWriter writer = Files.newBufferedWriter(Paths.get(outputDir, "swagger.json"), StandardCharsets.UTF_8); + writer.write(result.getResponse().getContentAsString()); + writer.flush(); + } } |