-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoBeanNameAvailableTest.kt
38 lines (31 loc) · 1.12 KB
/
NoBeanNameAvailableTest.kt
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
package org.example
import org.aspectj.lang.annotation.*
import org.example.general.*
import org.example.web.*
import org.junit.jupiter.api.*
import org.springframework.boot.*
import org.springframework.boot.builder.*
import org.springframework.test.web.reactive.server.*
class NoBeanNameAvailableTest {
lateinit var webTestClient: WebTestClient
@BeforeEach
fun setup() {
val generalContext = SpringApplicationBuilder(GeneralConfiguration::class.java)
.web(WebApplicationType.NONE)
.run()
val childContext = SpringApplicationBuilder(WebConfiguration::class.java)
.parent(generalContext)
.web(WebApplicationType.SERVLET)
.run()
val port = childContext.environment.getProperty("local.server.port")!!.toInt()
webTestClient = WebTestClient.bindToServer().baseUrl("http://localhost:$port").build()
}
@Test
fun `should be ok, but don't`() {
webTestClient.get()
.uri("/?name=Mike")
.exchange()
.expectStatus().isOk
.expectBody<String>().isEqualTo("Hello, Mike!")
}
}