aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-api/src/test/java/com/juick/api/tests/MessagesTests.java5
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java10
-rw-r--r--src/test/java/com/juick/tests/ApiTests.java5
3 files changed, 11 insertions, 9 deletions
diff --git a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
index a892656b..a9705aee 100644
--- a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
+++ b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java
@@ -3,6 +3,7 @@ package com.juick.api.tests;
import com.juick.Message;
import com.juick.Tag;
import com.juick.User;
+import com.juick.api.ApiServer;
import com.juick.api.TGBot;
import com.juick.api.configuration.ApiMvcConfiguration;
import com.juick.api.configuration.ApiSecurityConfig;
@@ -60,6 +61,10 @@ public class MessagesTests {
TGBot tgBot() {
return Mockito.mock(TGBot.class);
}
+ @Bean
+ ApiServer apiServer() {
+ return Mockito.mock(ApiServer.class);
+ }
}
private MockMvc mockMvc;
diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
index a5bc3f73..2e5a4f89 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
@@ -10,13 +10,11 @@ import com.juick.www.HelpService;
import com.juick.www.WebApp;
import com.juick.www.controllers.PageTemplates;
import org.apache.commons.io.IOUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.Environment;
import javax.annotation.Resource;
import javax.inject.Inject;
@@ -31,22 +29,16 @@ import java.util.HashMap;
@PropertySource("classpath:juick.conf")
@EnableCaching
public class WwwAppConfiguration {
- @Resource
- private Environment env;
@Inject
private UserService userService;
@Inject
private TagService tagService;
- @Inject
- private ObjectMapper jsonMapper;
- @Value("#{servletContext.contextPath}")
- private String servletContextPath;
@Bean
public WebApp webApp() throws IOException {
WebApp app = new WebApp();
String manifestString = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("manifest.json"), StandardCharsets.UTF_8);
- HashMap<String, String> manifest = jsonMapper.readValue(manifestString,
+ HashMap<String, String> manifest = jsonMapper().readValue(manifestString,
new TypeReference<HashMap<String, String>>() {});
app.setScriptsUrl(manifest.get("scripts.js"));
app.setStyleUrl(manifest.get("style.css"));
diff --git a/src/test/java/com/juick/tests/ApiTests.java b/src/test/java/com/juick/tests/ApiTests.java
index 778cc7af..aafbade6 100644
--- a/src/test/java/com/juick/tests/ApiTests.java
+++ b/src/test/java/com/juick/tests/ApiTests.java
@@ -14,6 +14,7 @@ import com.juick.service.SubscriptionService;
import com.juick.service.TagService;
import com.juick.service.UserService;
import com.juick.service.search.SearchService;
+import com.juick.www.WebApp;
import com.juick.www.controllers.PageTemplates;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.StringUtils;
@@ -120,6 +121,10 @@ public class ApiTests {
public Sape sape() {
return Mockito.mock(Sape.class);
}
+ @Bean
+ public WebApp webApp() {
+ return Mockito.mock(WebApp.class);
+ }
}
@Inject