From e8552c9b162daa5cf4e651330e278dee4ea5198f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 19 Dec 2016 22:53:53 +0300 Subject: fix protocol tests --- src/test/java/com/juick/tests/ApiTests.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/test') diff --git a/src/test/java/com/juick/tests/ApiTests.java b/src/test/java/com/juick/tests/ApiTests.java index 17bcc3db..931838d7 100644 --- a/src/test/java/com/juick/tests/ApiTests.java +++ b/src/test/java/com/juick/tests/ApiTests.java @@ -8,6 +8,7 @@ import com.juick.Tag; import com.juick.User; import com.juick.server.helpers.TagStats; import com.juick.server.protocol.JuickProtocol; +import com.juick.server.protocol.ProtocolListener; import com.juick.server.protocol.ProtocolReply; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; @@ -20,6 +21,8 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -122,10 +125,14 @@ public class ApiTests { @Inject JuickProtocol juickProtocol; + @Mock + ProtocolListener listener; + @Before public void setup() { userService.createUser("ugnich", "secret"); userService.createUser("juick", "secret"); + MockitoAnnotations.initMocks(this); } @Test public void messageTests() { @@ -175,6 +182,7 @@ public class ApiTests { @Test public void protocolTests() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, ParseException, JsonProcessingException { + juickProtocol.setListener(listener); assertEquals("juick user should have uid 2", 2, userService.getUIDbyName("juick")); int uid = userService.createUser("me", "secret"); User user = userService.getUserByUID(uid).orElse(new User()); -- cgit v1.2.3