aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-31 15:03:57 +0300
committerGravatar Vitaly Takmazov2018-10-31 15:03:57 +0300
commitd6385d656a0af52d9509f76dccce1172b663f2d9 (patch)
treeae9e24de7b71a80f7771a544163b7ea4c2e686ef /juick-server/src/test
parentf119f0b85b9b96f724997eaf53b38594340a91c4 (diff)
Fix tests
Diffstat (limited to 'juick-server/src/test')
-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 {