-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathIntegrationTestAbstract.java
More file actions
73 lines (69 loc) · 3.51 KB
/
Copy pathIntegrationTestAbstract.java
File metadata and controls
73 lines (69 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package fr.insee.genesis.controller;
import fr.insee.genesis.TransactionManagerTestConfig;
import fr.insee.genesis.controller.utils.ControllerUtils;
import fr.insee.genesis.domain.ports.spi.SurveyUnitQualityToolPort;
import fr.insee.genesis.infrastructure.repository.ContextualExternalVariableMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.ContextualPreviousVariableMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.DataProcessingContextMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.LastJsonExtractionMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.LunaticJsonMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.LunaticModelMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.QuestionnaireMetadataMongoDBRepository;
import fr.insee.genesis.infrastructure.repository.RawResponseRepository;
import fr.insee.genesis.infrastructure.repository.RundeckExecutionDBRepository;
import fr.insee.genesis.infrastructure.repository.SurveyUnitMongoDBRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.data.mongodb.autoconfigure.DataMongoAutoConfiguration;
import org.springframework.boot.mongodb.autoconfigure.MongoAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.context.annotation.Import;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
/**
* All integration tests must inherit this class
* It mocks all repositories and adds them to spring context
*/
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("test")
@TestPropertySource(properties = {
"logging.level.=DEBUG"
})
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class, DataMongoAutoConfiguration.class})
@Import(TransactionManagerTestConfig.class)
public abstract class IntegrationTestAbstract {
@Autowired
protected MockMvc mockMvc;
@MockitoBean
protected ControllerUtils controllerUtils;
@MockitoBean
protected MongoTemplate mongoTemplate;
@MockitoBean
protected RawResponseRepository rawResponseRepository;
@MockitoBean
protected SurveyUnitMongoDBRepository surveyUnitMongoDBRepository;
@MockitoBean
protected LastJsonExtractionMongoDBRepository lastJsonExtractionMongoDBRepository;
@MockitoBean
protected LunaticJsonMongoDBRepository lunaticJsonMongoDBRepository;
@MockitoBean
protected RundeckExecutionDBRepository rundeckExecutionDBRepository;
@MockitoBean
protected DataProcessingContextMongoDBRepository dataProcessingContextMongoDBRepository;
@MockitoBean
protected LunaticModelMongoDBRepository lunaticModelMongoDBRepository;
@MockitoBean
protected ContextualPreviousVariableMongoDBRepository contextualPreviousVariableMongoDBRepository;
@MockitoBean
protected ContextualExternalVariableMongoDBRepository contextualExternalVariableMongoDBRepository;
@MockitoBean
protected QuestionnaireMetadataMongoDBRepository questionnaireMetadataMongoDBRepository;
//Mocked quality tool port
@MockitoBean
protected SurveyUnitQualityToolPort surveyUnitQualityToolPort;
}