Skip to content

Commit

Permalink
Update test dependencies (#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
yevhenii-viktorov authored Nov 11, 2021
1 parent a4dc57c commit 18bd420
Show file tree
Hide file tree
Showing 46 changed files with 260 additions and 242 deletions.
29 changes: 22 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,22 @@
<maxmind-client.version>2.12.0</maxmind-client.version>

<!-- test dependencies versions -->
<junit.version>4.13.1</junit.version>
<mockito.version>2.23.4</mockito.version>
<assertj.version>3.8.0</assertj.version>
<wiremock.version>2.26.3</wiremock.version>
<awaitility.version>4.0.1</awaitility.version>
<junit.version>4.13.2</junit.version>
<mockito.version>4.0.0</mockito.version>
<assertj.version>3.21.0</assertj.version>
<wiremock.version>2.27.2</wiremock.version>
<awaitility.version>4.1.0</awaitility.version>
<jetty.version>9.4.43.v20210629</jetty.version>
<restassured.version>3.0.6</restassured.version>
<h2.version>1.4.196</h2.version>
<restassured.version>3.0.7</restassured.version>
<h2.version>1.4.200</h2.version>
<spock.version>1.3-groovy-2.5</spock.version>
<testcontainers.version>1.15.3</testcontainers.version>
<mockserver-client.version>5.11.2</mockserver-client.version>
<allure.version>2.14.0</allure.version>
<aspectj.version>1.9.7</aspectj.version>
<restassured.version>3.3.0</restassured.version>
<h2.version>1.4.200</h2.version>
<bytebuddy.version>1.11.19</bytebuddy.version>

<!-- plugin versions -->
<checkstyle-plugin.version>3.1.0</checkstyle-plugin.version>
Expand Down Expand Up @@ -423,6 +426,18 @@
<version>${restassured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${bytebuddy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${bytebuddy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;

public class PubstackAnalyticsReporterTest extends VertxTest {

Expand Down Expand Up @@ -118,8 +119,8 @@ public void initializeShouldFailUpdateSendBuffersAndSetTimerWhenEndpointFromRemo
.isInstanceOf(PreBidException.class);
verify(auctionHandler).reportEvents();
verify(setuidHandler).reportEvents();
verifyZeroInteractions(auctionHandler);
verifyZeroInteractions(setuidHandler);
verifyNoMoreInteractions(auctionHandler);
verifyNoMoreInteractions(setuidHandler);
verify(vertx).setPeriodic(anyLong(), any());
}

Expand Down Expand Up @@ -156,8 +157,8 @@ public void initializeShouldNotSendEventsAndUpdateConfigsWhenResponseStatusIsNot
// then
verify(vertx).setPeriodic(anyLong(), any());
verify(httpClient).get(anyString(), anyLong());
verifyZeroInteractions(auctionHandler);
verifyZeroInteractions(setuidHandler);
verifyNoInteractions(auctionHandler);
verifyNoInteractions(setuidHandler);
}

@Test
Expand All @@ -172,8 +173,8 @@ public void initializeShouldNotSendEventsAndUpdateConfigsWhenCantParseResponse()
// then
verify(vertx).setPeriodic(anyLong(), any());
verify(httpClient).get(anyString(), anyLong());
verifyZeroInteractions(auctionHandler);
verifyZeroInteractions(setuidHandler);
verifyNoInteractions(auctionHandler);
verifyNoInteractions(setuidHandler);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

public class PubstackEventHandlerTest extends VertxTest {

Expand Down Expand Up @@ -88,7 +88,7 @@ public void handleShouldNotAcceptEventsWhenNotEnabled() {
(AtomicReference<Set<String>>) ReflectionTestUtils
.getField(pubstackEventHandler, "events");
assertThat(events.get()).isEmpty();
verifyZeroInteractions(httpClient);
verifyNoInteractions(httpClient);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

public class BasicCategoryMappingServiceTest extends VertxTest {

Expand Down Expand Up @@ -175,7 +175,7 @@ public void applyCategoryMappingShouldNotCallFetchCategoryWhenTranslateCategorie
givenBidRequestWithTargeting(extRequestTargeting), timeout);

// then
verifyZeroInteractions(applicationSettings);
verifyNoInteractions(applicationSettings);
assertThat(resultFuture.succeeded()).isTrue();
final Map<Bid, String> expectedBidCategory = new HashMap<>();
expectedBidCategory.put(givenBid("1", null, "10", singletonList("cat1")), "10.00_cat1_10s");
Expand Down
29 changes: 15 additions & 14 deletions src/test/java/org/prebid/server/auction/ExchangeServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.prebid.server.assertion.FutureAssertion.assertThat;
import static org.prebid.server.proto.openrtb.ext.response.BidType.banner;
import static org.prebid.server.proto.openrtb.ext.response.BidType.video;

Expand Down Expand Up @@ -351,8 +352,8 @@ public void shouldTolerateImpWithoutExtension() {
final AuctionContext result = exchangeService.holdAuction(givenRequestContext(bidRequest)).result();

// then
verifyZeroInteractions(bidderCatalog);
verifyZeroInteractions(httpBidderRequester);
verifyNoInteractions(bidderCatalog);
verifyNoInteractions(httpBidderRequester);
assertThat(result).extracting(AuctionContext::getBidResponse).isNotNull();
}

Expand All @@ -368,7 +369,7 @@ public void shouldTolerateImpWithUnknownBidderInExtension() {

// then
verify(bidderCatalog).isValidName(eq("invalid"));
verifyZeroInteractions(httpBidderRequester);
verifyNoInteractions(httpBidderRequester);
assertThat(result).extracting(AuctionContext::getBidResponse).isNotNull();
}

Expand Down Expand Up @@ -507,7 +508,7 @@ public void shouldSkipBidderWhenRejectedByBidderRequestHooks() {
exchangeService.holdAuction(givenRequestContext(bidRequest));

// then
verifyZeroInteractions(httpBidderRequester);
verifyNoInteractions(httpBidderRequester);
}

@Test
Expand Down Expand Up @@ -671,7 +672,7 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() {
assertThat(prebid1).isNotNull();
final JsonNode bidders1 = prebid1.getBidders();
assertThat(bidders1).isNotNull();
assertThat(bidders1.fields()).hasSize(1)
assertThat(bidders1.fields()).toIterable().hasSize(1)
.containsOnly(entry("bidder", mapper.createObjectNode().put("test1", "test1")));

final ArgumentCaptor<BidderRequest> bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class);
Expand All @@ -681,7 +682,7 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() {
assertThat(prebid2).isNotNull();
final JsonNode bidders2 = prebid2.getBidders();
assertThat(bidders2).isNotNull();
assertThat(bidders2.fields()).hasSize(1)
assertThat(bidders2.fields()).toIterable().hasSize(1)
.containsOnly(entry("bidder", mapper.createObjectNode().put("test2", "test2")));
}

Expand Down Expand Up @@ -800,7 +801,7 @@ public void shouldNotCreateRequestForBidderRestrictedByPrivacyEnforcement() {
exchangeService.holdAuction(givenRequestContext(bidRequest));

// then
verifyZeroInteractions(httpBidderRequester);
verifyNoInteractions(httpBidderRequester);
}

@Test
Expand Down Expand Up @@ -1796,7 +1797,7 @@ public void shouldAddMultiBidInfoAboutRequestedBidderIfDataShouldNotBeSuppressed
final ExtRequest extRequest = captureBidRequest().getExt();
assertThat(extRequest)
.extracting(ExtRequest::getPrebid)
.flatExtracting("multibid")
.extracting(ExtRequestPrebid::getMultibid).asList()
.containsExactly(ExtRequestPrebidMultiBid.of("someBidder", null, 3, "prefix"));
}

Expand All @@ -1816,7 +1817,7 @@ public void shouldAddMultibidInfoOnlyAboutRequestedBidder() {
final ExtRequest extRequest = captureBidRequest().getExt();
assertThat(extRequest)
.extracting(ExtRequest::getPrebid)
.flatExtracting("multibid")
.extracting(ExtRequestPrebid::getMultibid).asList()
.containsExactly(ExtRequestPrebidMultiBid.of("someBidder", null, 3, null));
}

Expand Down Expand Up @@ -2490,10 +2491,10 @@ public void shouldRemoveSiteIfBothSiteAndAppPresent() {
final BidRequest captureBidRequest = captureBidRequest();
assertThat(captureBidRequest)
.extracting(BidRequest::getSite)
.containsNull();
.isNull();
assertThat(captureBidRequest)
.extracting(BidRequest::getApp)
.doesNotContainNull();
.isNotNull();
}

@Test
Expand All @@ -2511,7 +2512,7 @@ public void shouldAddDebugWarningIfBothSiteAndAppPresent() {
// then
assertThat(givenContext)
.extracting(AuctionContext::getDebugWarnings)
.containsExactly(singletonList("BidRequest contains app and site. Removed site object"));
.isEqualTo(singletonList("BidRequest contains app and site. Removed site object"));
}

@Test
Expand Down Expand Up @@ -3267,7 +3268,7 @@ public void shouldReturnEmptyBidResponseWhenRequestIsRejected() {
final AuctionContext result = exchangeService.holdAuction(auctionContext).result();

// then
verifyZeroInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator);
verifyNoInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator);
assertThat(result.getBidResponse())
.isEqualTo(BidResponse.builder()
.seatbid(emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

public class PrivacyEnforcementServiceTest extends VertxTest {

Expand Down Expand Up @@ -407,7 +407,7 @@ public void shouldMaskForCoppaWhenDeviceLmtIsEnforceAndOneAndRegsCoppaIsOneAndDo
.build();
assertThat(result).isEqualTo(singletonList(expected));

verifyZeroInteractions(tcfDefinerService);
verifyNoInteractions(tcfDefinerService);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

public class StoredRequestProcessorTest extends VertxTest {

Expand Down Expand Up @@ -543,7 +543,7 @@ public void shouldReturnImpAndBidRequestWithoutChangesIfStoredRequestIsAbsentInP
final Future<BidRequest> bidRequestFuture = storedRequestProcessor.processStoredRequests(null, bidRequest);

// then
verifyZeroInteractions(applicationSettings, metrics);
verifyNoInteractions(applicationSettings, metrics);
assertThat(bidRequestFuture.succeeded()).isTrue();
assertThat(bidRequestFuture.result().getImp().get(0)).isSameAs(imp);
assertThat(bidRequestFuture.result()).isSameAs(bidRequest);
Expand Down Expand Up @@ -737,7 +737,7 @@ public void processStoredRequestsShouldNotUpdateMetricsIfApplicationSettingsFail
ExtRequestPrebid.builder().storedrequest(ExtStoredRequest.of("bidRequest")).build()))));

// then
verifyZeroInteractions(metrics);
verifyNoInteractions(metrics);
}

@Test
Expand All @@ -750,7 +750,7 @@ public void processAmpRequestShouldNotUpdateMetricsIfApplicationSettingsFailed()
storedRequestProcessor.processAmpRequest(null, "123", BidRequest.builder().build());

// then
verifyZeroInteractions(metrics);
verifyNoInteractions(metrics);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

public class StoredResponseProcessorTest extends VertxTest {

Expand Down Expand Up @@ -112,7 +112,7 @@ public void getStoredResponseResultShouldNotChangeImpsAndReturnSeatBidsWhenThere
singletonList(imp),
emptyList(),
emptyMap()));
verifyZeroInteractions(applicationSettings);
verifyNoInteractions(applicationSettings);
}

@Test
Expand All @@ -134,7 +134,7 @@ public void getStoredResponseResultShouldAddImpToRequiredRequestWhenItsStoredAuc
.build()),
emptyList(),
emptyMap()));
verifyZeroInteractions(applicationSettings);
verifyNoInteractions(applicationSettings);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.prebid.server.assertion.FutureAssertion.assertThat;

public class AmpRequestFactoryTest extends VertxTest {
Expand Down Expand Up @@ -184,7 +184,7 @@ public void shouldReturnFailedFutureIfRequestHasNoTagId() {
final Future<?> future = target.fromRequest(routingContext, 0L);

// then
verifyZeroInteractions(storedRequestProcessor);
verifyNoInteractions(storedRequestProcessor);
assertThat(future.failed()).isTrue();
assertThat(future.cause()).isInstanceOf(InvalidRequestException.class);
assertThat(((InvalidRequestException) future.cause()).getMessages())
Expand Down Expand Up @@ -1344,7 +1344,7 @@ public void shouldReturnBidRequestWithExtPrebidDataBiddersUpdatedByFpdResolver()
verify(fpdResolver).resolveBidRequestExt(any(), any());
assertThat(request)
.extracting(BidRequest::getExt)
.containsOnly(ExtRequest.of(ExtRequestPrebid.builder()
.isEqualTo(ExtRequest.of(ExtRequestPrebid.builder()
.data(ExtRequestPrebidData.of(Arrays.asList("appnexus", "rubicon"), null)).build()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ public void shouldSetSiteExtIfNoReferer() {
// then
assertThat(result.getSite())
.extracting(Site::getExt)
.containsOnly(ExtSite.of(0, null));
.isEqualTo(ExtSite.of(0, null));
}

@Test
Expand Down Expand Up @@ -1628,7 +1628,7 @@ public void shouldSetDefaultIncludeBidderKeysToFalseIfIncludeBidderKeysIsMissedA
// then
assertThat(result.getExt())
.extracting(extBidRequest -> extBidRequest.getPrebid().getTargeting().getIncludebidderkeys())
.containsOnly(false);
.isEqualTo(false);
}

@Test
Expand Down
Loading

0 comments on commit 18bd420

Please sign in to comment.