From 9ad08dc78e0cdbe2cdebf10a96c800e72d48e48b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Jan 2023 14:14:58 +0300 Subject: Refactor messages service, remove 2 unneeded SQL queries --- src/test/java/com/juick/server/tests/ServerTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/test') 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 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()); -- cgit v1.2.3