diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/juick/tests/ApiTests.java | 8 |
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()); |