Hello I have a spring cloud gateway service, writ...
# help
Hello I have a spring cloud gateway service, written in kotlin, where I am defining a
that define some rules for different endpoints in terms of authentication/authorization. The service itself does not contain any controllers/routes. I am trying to come up with a up to test such config so whenever a new endpoint rule is added, the test run to make sure nothing else is broken. Setup: spring boot: v2.7.14 kotlin version: 1.7.21 java version: 17 wiremock: 3.2.0 and I added the following sample test
Copy code
import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.web.reactive.server.WebTestClient

@ContextConfiguration(classes = [SecurityConfig::class]) // That's config class containing a SecurityWebFilterChain
class SecurityConfigTest {

    private val mockServer = WireMockServer(4567)

    private val webTestClient = WebTestClient.bindToServer()

    fun setUp() {

    fun tearDown() {

    fun testGetRequest() {
                WireMock.aResponse().withBody("""{"users": [{"id": 1, "name": "John Doe"}]}""")

            .expectBody().json("""{"users": [{"id": 1, "name": "John Doe"}]}""")
Upon running the test, I get the following error
java.lang.NoSuchMethodError: 'void org.eclipse.jetty.server.NetworkTrafficServerConnector.setNetworkTrafficListener(org.eclipse.jetty.io.NetworkTrafficListener)'
Upon further investigation, I tried to upgrade the jetty-server to
as the current one used by wiremock is
. I got a different error which is
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/component/AbstractLifeCycle$StopException
Questions: • Is the above approach correct? • Are the dependencies version correct or is there some conflict?