aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java17
-rw-r--r--src/test/resources/application-sqlite.yml7
2 files changed, 11 insertions, 13 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 81718cab..64fbd030 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -371,10 +371,7 @@ public class ServerTests {
int mid2 = messagesService.createMessage(user.getUid(), "yo2", null, tagList);
Message msg2 = messagesService.getMessage(mid2).get();
assertEquals(1, msg2.getTags().size());
- Exception exc = assertThrows(UsernameTakenException.class, () -> {
- userService.createUser("ugnicH", "x");
- });
- assertEquals("Username taken", exc.getMessage());
+ assertThat(userService.createUser("ugnicH", "x").isEmpty(), is(true));
User hugnich = userService.createUser("hugnich", "x").orElseThrow(IllegalStateException::new);
int rid = messagesService.createReply(msg2.getMid(), 0, hugnich, "bla-bla", null);
assertEquals(1, rid);
@@ -929,7 +926,7 @@ public class ServerTests {
@Test
public void mailParserTest() throws Exception {
emailService.addEmail(ugnich.getUid(), "ugnich@example.com");
- int mid = messagesService.createMessage(ugnich.getUid(), "text", StringUtils.EMPTY, Set.of());
+ int mid = messagesService.createMessage(ugnich.getUid(), "text", null, Set.of());
String mail = String.format(
"MIME-Version: 1.0\n"
+ "Received: by 10.176.0.242 with HTTP; Fri, 16 Mar 2018 05:31:50 -0700 (PDT)\n"
@@ -1974,7 +1971,7 @@ public class ServerTests {
String deleteJsonStr = IOUtils.toString(new ClassPathResource("delete.json").getURI(),
StandardCharsets.UTF_8);
Delete delete = jsonMapper.readValue(deleteJsonStr, Delete.class);
- int mid = messagesService.createMessage(ugnich.getUid(), "YO", "", Set.of());
+ int mid = messagesService.createMessage(ugnich.getUid(), "YO", null, Set.of());
User extUser = new User();
extUser.setUri(URI.create("http://localhost:8080/users/xwatt"));
int rid = messagesService.createReply(mid, 0, extUser, "PEOPLE", null);
@@ -2098,7 +2095,7 @@ public class ServerTests {
User newUser = userService.createUser("newuser", "assword").orElseThrow(IllegalStateException::new);
assertThat(newUser.getUid(), greaterThanOrEqualTo(0));
assertThat(newUser.getSeen(), is(nullValue()));
- messagesService.createMessage(newUser.getUid(), "YO", "", Set.of());
+ messagesService.createMessage(newUser.getUid(), "YO", null, Set.of());
assertThat(userService.getUserByUID(newUser.getUid()).get().getSeen(), greaterThanOrEqualTo(now));
}
@@ -2255,7 +2252,7 @@ public class ServerTests {
@Test
public void federatedAttachmentsAsLinks() throws Exception {
- int mid = messagesService.createMessage(ugnich.getUid(), "test", StringUtils.EMPTY, Set.of());
+ int mid = messagesService.createMessage(ugnich.getUid(), "test", null, Set.of());
Message testMessage = MockUtils.mockMessage(mid, freefd, "reply");
String activity = IOUtils.toString(noteWithDocument.getInputStream(), StandardCharsets.UTF_8);
Announce announce = jsonMapper.readValue(activity, Announce.class);
@@ -2633,7 +2630,7 @@ public class ServerTests {
@Test
@Transactional
public void isSubscribed() {
- int mid = messagesService.createMessage(ugnich.getUid(), "test", "", Collections.emptySet());
+ int mid = messagesService.createMessage(ugnich.getUid(), "test", null, Collections.emptySet());
var msg = messagesService.getMessage(ugnich.getUid(), mid).orElseThrow();
assertThat(msg.isSubscribed(), is(false));
subscriptionService.subscribeMessage(msg, ugnich);
@@ -2661,7 +2658,7 @@ public class ServerTests {
@Test
public void messagePrivacyFlow() throws Exception {
userService.setPremium(ugnich.getUid(), true);
- int mid = messagesService.createMessage(ugnich.getUid(), "hidden", "", Collections.emptySet());
+ int mid = messagesService.createMessage(ugnich.getUid(), "hidden", null, Collections.emptySet());
var msg = messagesService.getMessage(ugnich.getUid(), mid).orElseThrow();
assertThat(msg.isFriendsOnly(), is(false));
mockMvc.perform(post("/api/messages/set_privacy?mid=" + mid)
diff --git a/src/test/resources/application-sqlite.yml b/src/test/resources/application-sqlite.yml
index 6a9c0516..9ffa0833 100644
--- a/src/test/resources/application-sqlite.yml
+++ b/src/test/resources/application-sqlite.yml
@@ -1,8 +1,9 @@
spring:
datasource:
- maxActive: 1
- type: org.springframework.jdbc.datasource.SimpleDriverDataSource
- url: jdbc:sqlite:data.db
+ hikari:
+ maximumPoolSize: 1
+ connectionTimeout: 3000
+ url: jdbc:sqlite:data.db?journal_mode=WAL
sql:
init:
platform: sqlite