Skip to content
Snippets Groups Projects
Commit 21864cc2 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Setup repository mockups for testing

parent aae11281
Branches
No related merge requests found
......@@ -19,6 +19,7 @@ package de.thm.arsnova;
import de.thm.arsnova.config.AppConfig;
import de.thm.arsnova.config.TestAppConfig;
import de.thm.arsnova.config.TestPersistanceConfig;
import de.thm.arsnova.config.TestSecurityConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -33,7 +34,7 @@ import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestSecurityConfig.class})
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestPersistanceConfig.class, TestSecurityConfig.class})
@ActiveProfiles("test")
public class ImageUtilsTest {
......
......@@ -31,7 +31,7 @@ import static org.junit.Assert.assertNull;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestSecurityConfig.class})
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestPersistanceConfig.class, TestSecurityConfig.class})
@ActiveProfiles("test")
public class AppConfigTest extends AbstractJUnit4SpringContextTests {
......
package de.thm.arsnova.config;
import de.thm.arsnova.persistance.*;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Profile("test")
@Configuration
public class TestPersistanceConfig {
@Bean
public LogEntryRepository logEntryRepository() {
return Mockito.mock(LogEntryRepository.class);
}
@Bean
public UserRepository userRepository() {
return Mockito.mock(UserRepository.class);
}
@Bean
public SessionRepository sessionRepository() {
return Mockito.mock(SessionRepository.class);
}
@Bean
public CommentRepository commentRepository() {
return Mockito.mock(CommentRepository.class);
}
@Bean
public ContentRepository contentRepository() {
return Mockito.mock(ContentRepository.class);
}
@Bean
public AnswerRepository answerRepository() {
return Mockito.mock(AnswerRepository.class);
}
@Bean
public MotdRepository motdRepository() {
return Mockito.mock(MotdRepository.class);
}
@Bean
public MotdListRepository motdListRepository() {
return Mockito.mock(MotdListRepository.class);
}
@Bean
public VisitedSessionRepository visitedSessionRepository() {
return Mockito.mock(VisitedSessionRepository.class);
}
@Bean
public StatisticsRepository statisticsRepository() {
return Mockito.mock(StatisticsRepository.class);
}
@Bean
public SessionStatisticsRepository sessionStatisticsRepository() {
return Mockito.mock(SessionStatisticsRepository.class);
}
}
......@@ -19,6 +19,7 @@ package de.thm.arsnova.controller;
import de.thm.arsnova.config.AppConfig;
import de.thm.arsnova.config.TestAppConfig;
import de.thm.arsnova.config.TestPersistanceConfig;
import de.thm.arsnova.config.TestSecurityConfig;
import de.thm.arsnova.services.StubUserService;
import org.junit.After;
......@@ -38,7 +39,7 @@ import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestSecurityConfig.class})
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestPersistanceConfig.class, TestSecurityConfig.class})
@ActiveProfiles("test")
public abstract class AbstractControllerTest extends AbstractJUnit4SpringContextTests {
......
......@@ -19,6 +19,7 @@ package de.thm.arsnova.services;
import de.thm.arsnova.config.AppConfig;
import de.thm.arsnova.config.TestAppConfig;
import de.thm.arsnova.config.TestPersistanceConfig;
import de.thm.arsnova.config.TestSecurityConfig;
import de.thm.arsnova.entities.User;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
......@@ -52,7 +53,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestSecurityConfig.class})
@ContextConfiguration(classes = {AppConfig.class, TestAppConfig.class, TestPersistanceConfig.class, TestSecurityConfig.class})
@ActiveProfiles("test")
public class UserServiceTest {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment