Skip to content
This repository was archived by the owner on Aug 9, 2025. It is now read-only.

Commit 608f8bd

Browse files
committed
refactor(rest): replace MockBean with MockitoBean
1 parent 733535e commit 608f8bd

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package packagename.rest
22

33
import org.springframework.boot.SpringBootConfiguration
4-
import org.springframework.boot.test.mock.mockito.MockBean
54
import org.springframework.context.annotation.ComponentScan
6-
import packagename.domain.port.RequestExample
75

86
@SpringBootConfiguration
97
@ComponentScan(basePackages = ["packagename"])
10-
class ExamplePoetryRestTestConfiguration {
11-
12-
@MockBean
13-
private lateinit var requestExample: RequestExample
14-
}
8+
class ExamplePoetryRestTestConfiguration

rest-adapter/src/test/kotlin/packagename/rest/ExampleResourceTest.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ import org.junit.jupiter.api.Test
55
import org.mockito.Mockito
66
import org.springframework.beans.factory.annotation.Autowired
77
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
8+
import org.springframework.test.context.bean.override.mockito.MockitoBean
89
import org.springframework.test.web.reactive.server.WebTestClient
910
import packagename.domain.exception.ExampleNotFoundException
1011
import packagename.domain.model.Example
11-
import packagename.rest.representation.ExampleInfo
1212
import packagename.domain.port.RequestExample
1313
import packagename.rest.exception.ExampleExceptionResponse
14+
import packagename.rest.representation.ExampleInfo
1415
import reactor.core.publisher.Flux
1516
import reactor.core.publisher.Mono
1617

1718
@WebFluxTest(ExampleResource::class)
1819
class ExampleResourceTest {
19-
20+
@MockitoBean
21+
private lateinit var requestExample: RequestExample
2022
companion object {
2123

2224
private const val API_URI = "/api/v1/examples"
@@ -25,9 +27,6 @@ class ExampleResourceTest {
2527
@Autowired
2628
private lateinit var webTestClient: WebTestClient
2729

28-
@Autowired
29-
private lateinit var requestExample: RequestExample
30-
3130
@Test
3231
fun `should start the rest adapter application`() {
3332
assertThat(java.lang.Boolean.TRUE).isTrue

0 commit comments

Comments
 (0)