- @Value("${wiremock.server.port}")
- private int wiremockPort;
-
- @Autowired RestTemplate restTemplate;
-
- @Test
- public void thatArtifactsCanBePushed() {
- WireMock.stubFor(
- WireMock.post(WireMock.urlEqualTo("/api/v2/spans"))
- .willReturn(
- WireMock.aResponse()
- .withStatus(HttpStatus.OK.value())));
-
- WireMock.stubFor(
- WireMock.get(WireMock.urlEqualTo("/"))
- .withHeader("X-B3-TraceId", WireMock.matching(".*"))
- .willReturn(
- WireMock.aResponse()
- .withStatus(HttpStatus.OK.value())));
-
-
- String response = restTemplate.getForObject("http://localhost:" + wiremockPort + "/", String.class);
- }
-
+ @Value("${wiremock.server.port}")
+ private int wiremockPort;
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Test
+ public void thatArtifactsCanBePushed() {
+ // Stub Zipkin POST /api/v2/spans
+ WireMock.stubFor(
+ WireMock.post(WireMock.urlEqualTo("/api/v2/spans"))
+ .willReturn(WireMock.aResponse()
+ .withStatus(HttpStatus.OK.value()))
+ );
+
+ // Stub GET /
+ WireMock.stubFor(
+ WireMock.get(WireMock.urlEqualTo("/"))
+ .willReturn(WireMock.aResponse()
+ .withStatus(HttpStatus.OK.value())
+ .withBody("ok"))
+ );
+
+ // Call the WireMock GET endpoint
+ String response = restTemplate.getForObject(
+ "http://localhost:" + wiremockPort + "/", String.class);
+ }