From b550d376b0f62bbe914da26500524acf5be22494 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 21 May 2020 12:10:32 +0300 Subject: Show correct signup errors --- src/test/java/com/juick/server/tests/ServerTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/test/java') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 51e17ecc..aad85884 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -381,7 +381,10 @@ public class ServerTests { int mid2 = messagesService.createMessage(user.getUid(), "yo2", null, tagList); Message msg2 = messagesService.getMessage(mid2).get(); assertEquals(1, msg2.getTags().size()); - assertEquals("we already have ugnich", Optional.empty(), userService.createUser("ugnich", "x")); + Exception exc = assertThrows(UsernameTakenException.class, () -> { + userService.createUser("ugnich", "x"); + }); + assertEquals("Username taken", exc.getMessage()); User hugnich = userService.createUser("hugnich", "x").orElseThrow(IllegalStateException::new); int rid = messagesService.createReply(msg2.getMid(), 0, hugnich, "bla-bla", null); assertEquals(1, rid); -- cgit v1.2.3