aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-19 22:53:53 +0300
committerGravatar Vitaly Takmazov2016-12-19 22:53:53 +0300
commite8552c9b162daa5cf4e651330e278dee4ea5198f (patch)
treed57e3dddda8ff37dbbca2f550fc4153a1e6c8123 /src/test/java/com
parent8fdbb5188d38a3f3420c5018281f3fd0259203e1 (diff)
fix protocol tests
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/juick/tests/ApiTests.java8
1 files changed, 8 insertions, 0 deletions
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());