aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick/server')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java19
1 files changed, 14 insertions, 5 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 e9f42ee3..d3654e90 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
@@ -212,6 +212,10 @@ public class ServerTests {
@Before
public void setUp() throws Exception {
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "p"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "photos-1024"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "photos-512"));
+ FileSystemUtils.deleteRecursively(Paths.get(imgDir, "ps"));
Files.createDirectory(Paths.get(imgDir, "p"));
Files.createDirectory(Paths.get(imgDir, "photos-1024"));
Files.createDirectory(Paths.get(imgDir, "photos-512"));
@@ -1314,7 +1318,7 @@ public class ServerTests {
return null;
}
};
- assertThat(getStatus.get().getInbound().size(), is(0));
+ assertThat(getStatus.get().getInbound(), is(nullValue()));
ConnectionIn test = new ConnectionIn(server, new Socket("localhost", server.getServerPort()));
test.from.add(Jid.of("test"));
server.getInConnections().clear();
@@ -1634,6 +1638,9 @@ public class ServerTests {
}
@Test
public void notificationsTests() throws Exception {
+ jdbcTemplate.execute("DELETE FROM messages");
+ jdbcTemplate.execute("DELETE FROM replies");
+ jdbcTemplate.execute("DELETE FROM subscr_messages");
MvcResult loginResult = mockMvc.perform(post("/login")
.param("username", freefdName)
.param("password", freefdPassword))
@@ -1664,10 +1671,12 @@ public class ServerTests {
.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();
+ if (StringUtils.isNotEmpty(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();
+ }
}
@Test
public void newMessageShouldNotContainDuplicatedTags() throws Exception {