billydharmawan
1 min readMay 6, 2020

--

The “whacky” port comes from WireMockContextInitializer class where it starts up a WireMockServer at a random port (dynamicPort). Then, it overrides the value specified in application.properties, so then the test application will be pointing to that WireMockServer instance, instead of the hardcoded port 8089.

In WireMockContextInitializer class, this is the part that sets the OpenWeather base url for test.

TestPropertyValues
.of("app.openweather.baseurl=http://localhost:${wireMockServer.port()}")
.applyTo(applicationContext)

It’s really hard to understand what is wrong with your case, because as I said, when I cloned the repo from Github and run the tests as they are, they work fine for me.

Have you tried to run ./gradlew clean build?

--

--

billydharmawan
billydharmawan

Written by billydharmawan

An ordinary man trying to leave a good legacy on earth

No responses yet