Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.eclipse.microprofile.rest.client.tck;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
Expand All @@ -30,6 +30,8 @@
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

import com.github.tomakehurst.wiremock.client.MappingBuilder;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.eclipse.microprofile.rest.client.tck.interfaces.ClientHeaderParamClient;
import org.eclipse.microprofile.rest.client.tck.providers.ReturnWithAllClientHeadersFilter;
Expand Down Expand Up @@ -66,18 +68,17 @@ private static void stub(String expectedHeaderName, String... expectedHeaderValu
String expectedIncomingHeader = Arrays.stream(expectedHeaderValue)
.collect(Collectors.joining(","));
String outputBody = expectedIncomingHeader.replace(',', '-');
MappingBuilder mappingBuilder = get(urlEqualTo("/"));

// headers can be sent either in a single line with comma-separated values or in multiple lines
// this should match both cases:
Arrays.stream(expectedHeaderValue)
.forEach(val -> mappingBuilder.withHeader(expectedHeaderName, containing(val)));
stubFor(
get(urlEqualTo("/"))
.withHeader(expectedHeaderName, equalTo(expectedIncomingHeader))
mappingBuilder
.willReturn(
aResponse().withStatus(200)
.withBody(outputBody)));
/*stubFor(
get(urlEqualTo("/"))
.withHeader(expectedHeaderName, equalTo(expectedHeaderValue))
.willReturn(
aResponse().withStatus(200)
.withBody(expectedHeaderValue)));*/
}
@BeforeTest
public void resetWiremock() {
Expand Down