diff options
Diffstat (limited to 'juick-xmpp/src/test/java/com')
-rw-r--r-- | juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java b/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java index ccc4f1d4d..11ca75cfe 100644 --- a/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java +++ b/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java @@ -1,5 +1,6 @@ package com.juick.xmpp.server; +import com.juick.User; import com.juick.components.JuickBot; import com.juick.components.XMPPServer; import com.juick.components.configuration.XmppAppConfiguration; @@ -18,16 +19,15 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.stanza.model.Message; import rocks.xmpp.core.stanza.model.Stanza; -import rocks.xmpp.core.stanza.model.StanzaError; -import rocks.xmpp.core.stanza.model.errors.Condition; import rocks.xmpp.core.stanza.model.server.ServerMessage; import javax.inject.Inject; +import java.lang.reflect.InvocationTargetException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -70,4 +70,10 @@ public class XMPPServerTests { Stanza msg = server.parse(xmlMessage); bot.incomingMessage((ServerMessage)msg); } + @Test + public void botCommandsTests() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { + assertThat(bot.processCommand(new User(), Jid.of("test@localhost"), "PING").get(), is("PONG")); + // tag help have two lines, others have 1 + assertThat(bot.processCommand(new User(), Jid.of("test@localhost"), "help").get().split("\n").length, is(17)); + } } |