aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp-wip/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp-wip/src/test/java')
-rw-r--r--juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java59
1 files changed, 11 insertions, 48 deletions
diff --git a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
index 2cad5fb40..72d9dfe9c 100644
--- a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
+++ b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
@@ -17,25 +17,16 @@
package com.juick.xmpp;
-import com.gargoylesoftware.htmlunit.WebClient;
import com.juick.components.XMPPRouter;
import com.juick.components.configuration.BotAppConfiguration;
-import com.juick.configuration.MockDataConfiguration;
-import com.juick.service.MessengerService;
-import com.juick.service.PrivacyQueriesService;
-import com.juick.service.ShowQueriesService;
-import org.junit.Before;
+import com.juick.configuration.DataConfiguration;
+import com.juick.service.ImagesService;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
-import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder;
-import org.springframework.web.context.WebApplicationContext;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.test.context.junit4.SpringRunner;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.ConnectionEvent;
@@ -52,40 +43,12 @@ import java.util.concurrent.ExecutorService;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
-@RunWith(SpringJUnit4ClassRunner.class)
-@WebAppConfiguration
-@ContextConfiguration
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
+ classes = { BotAppConfiguration.class, DataConfiguration.class})
public class XMPPTests {
- @Configuration
- @Import(value = {
- BotAppConfiguration.class, MockDataConfiguration.class
- })
- static class Config {
- @Bean
- public ShowQueriesService showQueriesService() {
- return Mockito.mock(ShowQueriesService.class);
- }
- @Bean
- public PrivacyQueriesService privacyQueriesService() {
- return Mockito.mock(PrivacyQueriesService.class);
- }
- @Bean
- public MessengerService messengerService() {
- return Mockito.mock(MessengerService.class);
- }
- }
-
- @Inject
- private WebApplicationContext wac;
-
- private WebClient webClient;
-
- @Before
- public void setup() {
- webClient = MockMvcWebClientBuilder.webAppContextSetup(this.wac).build();
- webClient.getOptions().setJavaScriptEnabled(false);
- }
-
+ @MockBean
+ ImagesService imagesService;
@Inject
XMPPRouter router;
@Inject