|
| 1 | +package org.prebid.server.it; |
| 2 | + |
| 3 | +import io.restassured.response.Response; |
| 4 | +import org.json.JSONException; |
| 5 | +import org.junit.jupiter.api.Test; |
| 6 | +import org.prebid.server.model.Endpoint; |
| 7 | + |
| 8 | +import java.io.IOException; |
| 9 | +import java.util.List; |
| 10 | + |
| 11 | +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; |
| 12 | +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; |
| 13 | +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; |
| 14 | +import static com.github.tomakehurst.wiremock.client.WireMock.post; |
| 15 | +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; |
| 16 | + |
| 17 | +public class NetAddictionTest extends IntegrationTest { |
| 18 | + |
| 19 | + @Test |
| 20 | + public void openrtb2AuctionShouldRespondWithBidsFromNetaddiction() throws IOException, JSONException { |
| 21 | + // given |
| 22 | + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/netaddiction-exchange")) |
| 23 | + .withQueryParam("host", equalTo("host")) |
| 24 | + .withRequestBody(equalToJson( |
| 25 | + jsonFrom("openrtb2/netaddiction/test-netaddiction-bid-request.json"))) |
| 26 | + .willReturn(aResponse().withBody( |
| 27 | + jsonFrom("openrtb2/netaddiction/test-netaddiction-bid-response.json")))); |
| 28 | + |
| 29 | + // when |
| 30 | + final Response response = responseFor( |
| 31 | + "openrtb2/netaddiction/test-auction-netaddiction-request.json", |
| 32 | + Endpoint.openrtb2_auction); |
| 33 | + |
| 34 | + // then |
| 35 | + assertJsonEquals( |
| 36 | + "openrtb2/netaddiction/test-auction-netaddiction-response.json", |
| 37 | + response, |
| 38 | + List.of("netaddiction")); |
| 39 | + } |
| 40 | + |
| 41 | +} |
0 commit comments