I have written integration tests in Spock. Configured Spring boot context to random port. Documantation claims that then sprig should inject me properly configured WebTestClient
instance however when i'm trying to make a call by those "autoconfigured instance I have error given below:
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:8080
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Request to POST http://localhost:8080/sign-up [DefaultWebClient]
Here is my code: BaseIntegrationTest
@SpringBootTest(webEnvironment = RANDOM_PORT, classes= QuizItApplication.class)
@ContextConfiguration
@EnableConfigurationProperties
abstract class BaseIntegrationSpec extends Specification {
Class using WebTestClient:
@Component
class WebTestClientWrapper {
@Autowired
private WebTestClient webTestClient
@Autowired
private ObjectMapper objectMapper
Aucun commentaire:
Enregistrer un commentaire