mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-20 17:56:50 +00:00
test: mock UserRoleService only in nested test class
This commit is contained in:
parent
52171e8ebe
commit
f419acb924
@ -89,7 +89,6 @@ abstract class MockSink : Sinks.Many<Boolean>
|
|||||||
TransformationService::class,
|
TransformationService::class,
|
||||||
GPasConnectionCheckService::class,
|
GPasConnectionCheckService::class,
|
||||||
RestConnectionCheckService::class,
|
RestConnectionCheckService::class,
|
||||||
UserRoleService::class
|
|
||||||
)
|
)
|
||||||
class ConfigControllerTest {
|
class ConfigControllerTest {
|
||||||
|
|
||||||
@ -97,20 +96,17 @@ class ConfigControllerTest {
|
|||||||
private lateinit var webClient: WebClient
|
private lateinit var webClient: WebClient
|
||||||
|
|
||||||
private lateinit var requestProcessor: RequestProcessor
|
private lateinit var requestProcessor: RequestProcessor
|
||||||
private lateinit var userRoleService: UserRoleService
|
|
||||||
private lateinit var connectionCheckUpdateProducer: Sinks.Many<ConnectionCheckResult>
|
private lateinit var connectionCheckUpdateProducer: Sinks.Many<ConnectionCheckResult>
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
fun setup(
|
fun setup(
|
||||||
@Autowired mockMvc: MockMvc,
|
@Autowired mockMvc: MockMvc,
|
||||||
@Autowired requestProcessor: RequestProcessor,
|
@Autowired requestProcessor: RequestProcessor,
|
||||||
@Autowired userRoleService: UserRoleService,
|
|
||||||
@Autowired connectionCheckUpdateProducer: Sinks.Many<ConnectionCheckResult>
|
@Autowired connectionCheckUpdateProducer: Sinks.Many<ConnectionCheckResult>
|
||||||
) {
|
) {
|
||||||
this.mockMvc = mockMvc
|
this.mockMvc = mockMvc
|
||||||
this.webClient = MockMvcWebClientBuilder.mockMvcSetup(mockMvc).build()
|
this.webClient = MockMvcWebClientBuilder.mockMvcSetup(mockMvc).build()
|
||||||
this.requestProcessor = requestProcessor
|
this.requestProcessor = requestProcessor
|
||||||
this.userRoleService = userRoleService
|
|
||||||
this.connectionCheckUpdateProducer = connectionCheckUpdateProducer
|
this.connectionCheckUpdateProducer = connectionCheckUpdateProducer
|
||||||
|
|
||||||
webClient.options.isThrowExceptionOnScriptError = false
|
webClient.options.isThrowExceptionOnScriptError = false
|
||||||
@ -256,10 +252,19 @@ class ConfigControllerTest {
|
|||||||
"app.security.admin-password={noop}very-secret"
|
"app.security.admin-password={noop}very-secret"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@MockBean(
|
||||||
|
UserRoleService::class
|
||||||
|
)
|
||||||
inner class WithUserRolesEnabled {
|
inner class WithUserRolesEnabled {
|
||||||
|
private lateinit var userRoleService: UserRoleService
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
fun setup() {
|
fun setup(
|
||||||
|
@Autowired userRoleService: UserRoleService
|
||||||
|
) {
|
||||||
webClient.options.isThrowExceptionOnScriptError = false
|
webClient.options.isThrowExceptionOnScriptError = false
|
||||||
|
|
||||||
|
this.userRoleService = userRoleService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user