diff options
author | Vitaly Takmazov | 2018-09-12 15:29:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-09-12 15:29:37 +0300 |
commit | ddf8c3c0f07c0ca2fa6444c4511b61fc9a5c496c (patch) | |
tree | 486cc99823acb4159a3fd29bbc566dd69d3bdace /juick-server/src/test/java/com/juick/server/tests/ServerTests.java | |
parent | e97801561c497021a03317090b82d3c2568b1da7 (diff) |
static swagger docs
Diffstat (limited to 'juick-server/src/test/java/com/juick/server/tests/ServerTests.java')
-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(); + } } |