Skip to content

Commit 771ac46

Browse files
author
Emil Nadimanov
committed
Separated the integration test for an alias from Smartadserver's test (#3608)
1 parent f2ed4ca commit 771ac46

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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.equalToJson;
13+
import static com.github.tomakehurst.wiremock.client.WireMock.post;
14+
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
15+
16+
// Alias for Smartadserver
17+
public class EquativTest extends IntegrationTest {
18+
19+
@Test
20+
public void openrtb2AuctionShouldRespondWithBidsFromEquativ() throws IOException, JSONException {
21+
// given
22+
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/smartadserver-exchange/api/bid"))
23+
.withRequestBody(
24+
equalToJson(jsonFrom("openrtb2/smartadserver/alias/test-equativ-bid-request.json")))
25+
.willReturn(aResponse()
26+
.withBody(jsonFrom("openrtb2/smartadserver/alias/test-equativ-bid-response.json"))));
27+
28+
// when
29+
final Response response = responseFor(
30+
"openrtb2/smartadserver/alias/test-auction-equativ-request.json",
31+
Endpoint.openrtb2_auction);
32+
33+
// then
34+
assertJsonEquals("openrtb2/smartadserver/alias/test-auction-equativ-response.json", response,
35+
List.of("smartadserver", "equativ"));
36+
}
37+
}

src/test/java/org/prebid/server/it/SmartadserverTest.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
1212
import static com.github.tomakehurst.wiremock.client.WireMock.post;
1313
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
14-
import static java.util.Arrays.asList;
1514
import static java.util.Collections.singletonList;
1615

1716
public class SmartadserverTest extends IntegrationTest {
1817

19-
private static final String SMARTADSERVER = "smartadserver";
20-
private static final String EQUATIV_ALIAS = "equativ";
21-
2218
@Test
2319
public void openrtb2AuctionShouldRespondWithBidsFromSmartadserver() throws IOException, JSONException {
2420
// given
@@ -33,25 +29,7 @@ public void openrtb2AuctionShouldRespondWithBidsFromSmartadserver() throws IOExc
3329

3430
// then
3531
assertJsonEquals("openrtb2/smartadserver/test-auction-smartadserver-response.json", response,
36-
singletonList(SMARTADSERVER));
32+
singletonList("smartadserver"));
3733
}
3834

39-
@Test
40-
public void openrtb2AuctionShouldRespondWithBidsFromEquativ() throws IOException, JSONException {
41-
// given
42-
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/smartadserver-exchange/api/bid"))
43-
.withRequestBody(
44-
equalToJson(jsonFrom("openrtb2/smartadserver/alias/test-smartadserver-bid-request.json")))
45-
.willReturn(aResponse()
46-
.withBody(jsonFrom("openrtb2/smartadserver/alias/test-smartadserver-bid-response.json"))));
47-
48-
// when
49-
final Response response = responseFor(
50-
"openrtb2/smartadserver/alias/test-auction-smartadserver-request.json",
51-
Endpoint.openrtb2_auction);
52-
53-
// then
54-
assertJsonEquals("openrtb2/smartadserver/alias/test-auction-smartadserver-response.json", response,
55-
asList(SMARTADSERVER, EQUATIV_ALIAS));
56-
}
5735
}

src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-auction-smartadserver-request.json renamed to src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-auction-equativ-request.json

File renamed without changes.

src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-auction-smartadserver-response.json renamed to src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-auction-equativ-response.json

File renamed without changes.

src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-smartadserver-bid-request.json renamed to src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-equativ-bid-request.json

File renamed without changes.

src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-smartadserver-bid-response.json renamed to src/test/resources/org/prebid/server/it/openrtb2/smartadserver/alias/test-equativ-bid-response.json

File renamed without changes.

0 commit comments

Comments
 (0)