diff options
author | Vitaly Takmazov | 2023-01-22 14:14:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-22 14:14:58 +0300 |
commit | 9ad08dc78e0cdbe2cdebf10a96c800e72d48e48b (patch) | |
tree | 25ef5787f8a77bd24c40490edaafe7d8a4697389 /src/test/java/com/juick/server | |
parent | d17e5714c9b421fce507d310fd913ce3160a1764 (diff) |
Refactor messages service, remove 2 unneeded SQL queries
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index bb70e875..b7b78fa9 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -389,7 +389,7 @@ public class ServerTests { assertEquals("yo", msg.getText()); User me = msg.getUser(); assertEquals("mmmme", me.getName()); - assertEquals("mmmme", messagesService.getMessageAuthor(mid).getName()); + assertEquals("mmmme", msg.getUser().getName()); int tagID = tagService.createTag("weather"); Tag tag = tagService.getTag(tagID); Set<Tag> tagList = Set.of(tag); @@ -1439,7 +1439,8 @@ public class ServerTests { jdbcTemplate.update("UPDATE messages_txt SET updated_at='1990-05-05 00:00:00' WHERE message_id=?", original.getMid()); assertThat(messagesService.deleteMessage(ugnich.getUid(), original.getMid()), is(true)); - assertThat(messagesService.getMessageAuthor(original.getMid()), is(archiveUser)); + + assertThat(messagesService.getMessage(original.getMid()).orElseThrow().getUser(), is(archiveUser)); jdbcTemplate.update("UPDATE messages_txt SET updated_at=? WHERE message_id=?", Timestamp.from(Instant.now()), original.getMid()); |