From 99fad8158349a0e84f518595f18acfaf0e2c9a4f Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Tue, 5 Oct 2021 15:18:41 +0300 Subject: [PATCH 01/25] Adds that video ads are returned as VAST wrappers via the 'adm' field in addition to being returned as plain URLs via the 'nurl' field. --- .../org/prebid/server/bidder/yieldlab/YieldlabBidder.java | 7 +++++++ .../prebid/server/bidder/yieldlab/YieldlabBidderTest.java | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java index 29aca137843..e52e41f6f93 100644 --- a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java +++ b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java @@ -58,6 +58,7 @@ public class YieldlabBidder implements Bidder { private static final String CREATIVE_ID = "%s%s%s"; private static final String AD_SOURCE_BANNER = ""; private static final String AD_SOURCE_URL = "https://ad.yieldlab.net/d/%s/%s/%s?%s"; + private static final String VAST_MARKUP = "Yieldlab"; private final String endpointUrl; private final JacksonMapper mapper; @@ -283,6 +284,7 @@ private BidderBid resolveBidderBid(List yieldlabResponses, if (currentImp.getVideo() != null) { bidType = BidType.video; updatedBid.nurl(makeNurl(bidRequest, matchedExtImp, yieldlabResponse)); + updatedBid.adm(makeVast(bidRequest, matchedExtImp, yieldlabResponse)); } else if (currentImp.getBanner() != null) { bidType = BidType.banner; updatedBid.adm(makeAdm(bidRequest, matchedExtImp, yieldlabResponse)); @@ -360,6 +362,11 @@ private String makeAdm(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, Yie return String.format(AD_SOURCE_BANNER, makeNurl(bidRequest, extImpYieldlab, yieldlabResponse)); } + private String makeVast(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, YieldlabResponse yieldlabResponse) { + return String.format(VAST_MARKUP, extImpYieldlab.getAdslotId(), + makeNurl(bidRequest, extImpYieldlab, yieldlabResponse)); + } + private static String makeNurl(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, YieldlabResponse yieldlabResponse) { // for passing validation tests diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index ecd64ccf507..3d01e36bf95 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -231,9 +231,11 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio // then final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); - final String adm = String.format( - "", - timestamp); + final String adm = "" + + "Yieldlab" + + "" + + "" + + ""; final BidderBid expected = BidderBid.of( Bid.builder() .id("1") From a95573fde21471bee235c846547096c1731bf110 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Tue, 5 Oct 2021 17:28:55 +0300 Subject: [PATCH 02/25] added one test case to cover video change --- .../bidder/yieldlab/YieldlabBidder.java | 4 +- .../bidder/yieldlab/YieldlabBidderTest.java | 75 +++++++++++++++++-- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java index e52e41f6f93..18b60548b71 100644 --- a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java +++ b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java @@ -58,7 +58,9 @@ public class YieldlabBidder implements Bidder { private static final String CREATIVE_ID = "%s%s%s"; private static final String AD_SOURCE_BANNER = ""; private static final String AD_SOURCE_URL = "https://ad.yieldlab.net/d/%s/%s/%s?%s"; - private static final String VAST_MARKUP = "Yieldlab"; + private static final String VAST_MARKUP = "Yieldlab" + + "" + + ""; private final String endpointUrl; private final JacksonMapper mapper; diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index 3d01e36bf95..aae8f5e6813 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -8,6 +8,7 @@ import com.iab.openrtb.request.Regs; import com.iab.openrtb.request.Site; import com.iab.openrtb.request.User; +import com.iab.openrtb.request.Video; import com.iab.openrtb.response.Bid; import org.junit.Before; import org.junit.Test; @@ -231,11 +232,9 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio // then final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); - final String adm = "" + - "Yieldlab" + - "" + - "" + - ""; + final String adm = String.format( + "", + timestamp); final BidderBid expected = BidderBid.of( Bid.builder() .id("1") @@ -253,6 +252,72 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio assertThat(result.getValue()).containsExactly(expected); } + @Test + public void makeBidsShouldReturnCorrectBidderBidWithVideo() throws JsonProcessingException { + // given + final BidRequest bidRequest = BidRequest.builder() + .imp(singletonList(Imp.builder() + .id("test-imp-id") + .banner(Banner.builder().w(728).h(90).build()) + .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpYieldlab.builder() + .adslotId("12345") + .supplyId("123456789") + .adSize("728x90") + .targeting(singletonMap("key", "value")) + .extId("abc") + .build()))) + .video(Video.builder() + .mimes(singletonList("video/mp4")) + .w(1) + .h(2) + .minduration(1) + .maxduration(2) + .build()) + .build())) + .device(Device.builder().ip("ip").ua("Agent").language("fr").devicetype(1).build()) + .regs(Regs.of(1, ExtRegs.of(1, "usPrivacy"))) + .user(User.builder().buyeruid("buyeruid").ext(ExtUser.builder().consent("consent").build()).build()) + .site(Site.builder().page("http://www.example.com").build()) + .build(); + + final YieldlabResponse yieldlabResponse = YieldlabResponse.of(12345, 201d, "yieldlab", + "728x90", 1234, 5678, "40cb3251-1e1e-4cfd-8edc-7d32dc1a21e5"); + + final HttpCall httpCall = givenHttpCall(mapper.writeValueAsString(yieldlabResponse)); + + // when + final Result> result = yieldlabBidder.makeBids(httpCall, bidRequest); + + // then + final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); + final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); + final String adm = String.format("" + + "Yieldlab" + + "" + + "" + + "" + + "", timestamp); + final BidderBid expected = BidderBid.of( + Bid.builder() + .id("12345") + .impid("test-imp-id") + .price(BigDecimal.valueOf(2.01)) + .crid(String.format("123451234%s", weekNumber)) + .dealid("1234") + .w(728) + .h(90) + .nurl(String.format("https://ad.yieldlab.net/d/12345/123456789/728x90?ts=%s&id=abc&pvid=40cb3251-" + + "1e1e-4cfd-8edc-7d32dc1a21e5&ids=buyeruid&gdpr=1&consent=consent", timestamp)) + .adm(adm) + .build(), + BidType.video, "EUR"); + + assertThat(result.getErrors()).isEmpty(); + List value = result.getValue(); + assertThat(result.getValue()).containsExactly(expected); + } + private static HttpCall givenHttpCall(String body) { return HttpCall.success( HttpRequest.builder().build(), From a9f8300e71fc33bffab1f722e146264947ebe511 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Wed, 6 Oct 2021 13:33:13 +0300 Subject: [PATCH 03/25] test covers only adm creation --- .../bidder/yieldlab/YieldlabBidder.java | 5 +- .../bidder/yieldlab/YieldlabBidderTest.java | 47 +++++-------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java index 18b60548b71..5b86431429c 100644 --- a/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java +++ b/src/main/java/org/prebid/server/bidder/yieldlab/YieldlabBidder.java @@ -286,7 +286,7 @@ private BidderBid resolveBidderBid(List yieldlabResponses, if (currentImp.getVideo() != null) { bidType = BidType.video; updatedBid.nurl(makeNurl(bidRequest, matchedExtImp, yieldlabResponse)); - updatedBid.adm(makeVast(bidRequest, matchedExtImp, yieldlabResponse)); + updatedBid.adm(resolveAdm(bidRequest, matchedExtImp, yieldlabResponse)); } else if (currentImp.getBanner() != null) { bidType = BidType.banner; updatedBid.adm(makeAdm(bidRequest, matchedExtImp, yieldlabResponse)); @@ -364,7 +364,8 @@ private String makeAdm(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, Yie return String.format(AD_SOURCE_BANNER, makeNurl(bidRequest, extImpYieldlab, yieldlabResponse)); } - private String makeVast(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, YieldlabResponse yieldlabResponse) { + private static String resolveAdm(BidRequest bidRequest, ExtImpYieldlab extImpYieldlab, + YieldlabResponse yieldlabResponse) { return String.format(VAST_MARKUP, extImpYieldlab.getAdslotId(), makeNurl(bidRequest, extImpYieldlab, yieldlabResponse)); } diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index aae8f5e6813..787f1d969d9 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -253,31 +253,23 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio } @Test - public void makeBidsShouldReturnCorrectBidderBidWithVideo() throws JsonProcessingException { + public void makeBidsShouldReturnCorrectAdm() throws JsonProcessingException { // given final BidRequest bidRequest = BidRequest.builder() .imp(singletonList(Imp.builder() .id("test-imp-id") - .banner(Banner.builder().w(728).h(90).build()) .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpYieldlab.builder() .adslotId("12345") .supplyId("123456789") .adSize("728x90") - .targeting(singletonMap("key", "value")) .extId("abc") .build()))) .video(Video.builder() .mimes(singletonList("video/mp4")) .w(1) .h(2) - .minduration(1) - .maxduration(2) .build()) .build())) - .device(Device.builder().ip("ip").ua("Agent").language("fr").devicetype(1).build()) - .regs(Regs.of(1, ExtRegs.of(1, "usPrivacy"))) - .user(User.builder().buyeruid("buyeruid").ext(ExtUser.builder().consent("consent").build()).build()) - .site(Site.builder().page("http://www.example.com").build()) .build(); final YieldlabResponse yieldlabResponse = YieldlabResponse.of(12345, 201d, "yieldlab", @@ -289,33 +281,20 @@ public void makeBidsShouldReturnCorrectBidderBidWithVideo() throws JsonProcessin final Result> result = yieldlabBidder.makeBids(httpCall, bidRequest); // then - final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); - final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); - final String adm = String.format("" - + "Yieldlab" - + "" - + "" - + "" - + "", timestamp); - final BidderBid expected = BidderBid.of( - Bid.builder() - .id("12345") - .impid("test-imp-id") - .price(BigDecimal.valueOf(2.01)) - .crid(String.format("123451234%s", weekNumber)) - .dealid("1234") - .w(728) - .h(90) - .nurl(String.format("https://ad.yieldlab.net/d/12345/123456789/728x90?ts=%s&id=abc&pvid=40cb3251-" - + "1e1e-4cfd-8edc-7d32dc1a21e5&ids=buyeruid&gdpr=1&consent=consent", timestamp)) - .adm(adm) - .build(), - BidType.video, "EUR"); + final String expectedAdmStartsWith = "Yieldlab" + + "" + + ""; assertThat(result.getErrors()).isEmpty(); - List value = result.getValue(); - assertThat(result.getValue()).containsExactly(expected); + + assertThat(result.getValue()).hasSize(1) + .extracting(BidderBid::getBid) + .extracting(Bid::getAdm) + .allSatisfy(adm -> { + assertThat(adm).startsWith(expectedAdmStartsWith); + assertThat(adm).endsWith(expectedAdmEndsWith); + }); } private static HttpCall givenHttpCall(String body) { From 896ce0c76701d303554229bfeb15df8cf169049e Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Wed, 6 Oct 2021 16:50:17 +0300 Subject: [PATCH 04/25] this commit will check adm with nurl inside it --- .../bidder/yieldlab/YieldlabBidderTest.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index 787f1d969d9..849d17956fb 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -264,11 +264,7 @@ public void makeBidsShouldReturnCorrectAdm() throws JsonProcessingException { .adSize("728x90") .extId("abc") .build()))) - .video(Video.builder() - .mimes(singletonList("video/mp4")) - .w(1) - .h(2) - .build()) + .video(Video.builder().build()) .build())) .build(); @@ -281,20 +277,20 @@ public void makeBidsShouldReturnCorrectAdm() throws JsonProcessingException { final Result> result = yieldlabBidder.makeBids(httpCall, bidRequest); // then - final String expectedAdmStartsWith = "Yieldlab" - + "" - + ""; + final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); + final String expectedAdm = String.format("" + + "Yieldlab" + + "" + + "" + + "" + + "", timestamp); assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(1) .extracting(BidderBid::getBid) .extracting(Bid::getAdm) - .allSatisfy(adm -> { - assertThat(adm).startsWith(expectedAdmStartsWith); - assertThat(adm).endsWith(expectedAdmEndsWith); - }); + .satisfies(adm -> adm.equals(expectedAdm)); } private static HttpCall givenHttpCall(String body) { From bfd5c11c4dc8659cd2e1dde9c6ce29ffbb02b99f Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Thu, 7 Oct 2021 12:19:07 +0300 Subject: [PATCH 05/25] Check if result containsExactly in test instead of satisfies --- .../org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index 849d17956fb..49e7c54bf07 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -290,7 +290,7 @@ public void makeBidsShouldReturnCorrectAdm() throws JsonProcessingException { assertThat(result.getValue()).hasSize(1) .extracting(BidderBid::getBid) .extracting(Bid::getAdm) - .satisfies(adm -> adm.equals(expectedAdm)); + .containsExactly(expectedAdm); } private static HttpCall givenHttpCall(String body) { From 7b3736d324010be2b95c5aa1c162cd9b5f7c68b1 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Thu, 7 Oct 2021 23:40:05 +0300 Subject: [PATCH 06/25] Update test dependencies: tests refactoring to update AssertJ --- pom.xml | 12 ++++++------ .../prebid/server/auction/ExchangeServiceTest.java | 12 ++++++------ .../requestfactory/AmpRequestFactoryTest.java | 2 +- .../Ortb2ImplicitParametersResolverTest.java | 4 ++-- .../requestfactory/Ortb2RequestFactoryTest.java | 2 +- .../server/bidder/HttpBidderRequesterTest.java | 2 +- .../server/bidder/appnexus/AppnexusBidderTest.java | 4 ++-- .../server/deals/DeliveryProgressServiceTest.java | 2 +- .../server/hooks/execution/HookCatalogTest.java | 14 +++++++------- .../config/bidder/util/UsersyncerCreatorTest.java | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index a2b9873c30b..a4143aa3cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -47,14 +47,14 @@ 2.12.0 - 4.13.1 + 4.13.2 2.23.4 - 3.8.0 - 2.26.3 - 4.0.1 + 3.21.0 + 2.27.2 + 4.1.0 9.4.43.v20210629 - 3.0.6 - 1.4.196 + 3.0.7 + 1.4.200 3.1.0 diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 46fc0445a17..4bcb5e436dd 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -659,7 +659,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 bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); @@ -669,7 +669,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"))); } @@ -1643,7 +1643,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")); } @@ -1663,7 +1663,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)); } @@ -2337,10 +2337,10 @@ public void shouldRemoveSiteIfBothSiteAndAppPresent() { final BidRequest captureBidRequest = captureBidRequest(); assertThat(captureBidRequest) .extracting(BidRequest::getSite) - .containsNull(); + .isNull(); assertThat(captureBidRequest) .extracting(BidRequest::getApp) - .doesNotContainNull(); + .isNotNull(); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index d588076a8b8..500a4a0a8d4 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -1324,7 +1324,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())); } diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java index 061fd22e721..ea2f8b6000e 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java @@ -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 @@ -1628,7 +1628,7 @@ public void shouldSetDefaultIncludeBidderKeysToFalseIfIncludeBidderKeysIsMissedA // then assertThat(result.getExt()) .extracting(extBidRequest -> extBidRequest.getPrebid().getTargeting().getIncludebidderkeys()) - .containsOnly(false); + .isEqualTo(false); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index 76ea22589cb..84d4bead9a4 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -831,7 +831,7 @@ public void enrichBidRequestWithAccountAndPrivacyDataShouldReturnIntegrationFrom // then assertThat(result) .extracting(auctionBidRequest -> auctionBidRequest.getExt().getPrebid().getIntegration()) - .containsOnly(integration); + .isEqualTo(integration); } @Test diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 3570a9f6b6f..634d5f30800 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -175,7 +175,7 @@ public void shouldPassStoredResponseToBidderMakeBidsMethodAndReturnSeatBids() { verify(bidder).makeBids(httpCallArgumentCaptor.capture(), any()); assertThat(httpCallArgumentCaptor.getValue().getResponse()) .extracting(HttpResponse::getBody) - .containsOnly("storedResponse"); + .isEqualTo("storedResponse"); assertThat(bidderSeatBid.getBids()).containsOnlyElementsOf(bids); } diff --git a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java index 53217e24c59..3d0171932b2 100644 --- a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java @@ -478,8 +478,8 @@ public void makeHttpRequestsShouldSetImpTagidAndImpBidFloorIfExtImpAppnexusHasIn // then assertThat(result.getValue()).hasSize(1) .extracting(res -> mapper.readValue(res.getBody(), BidRequest.class)) - .element(0).extracting(BidRequest::getImp).hasSize(1) - .containsOnly(singletonList(Imp.builder() + .element(0).extracting(BidRequest::getImp) + .isEqualTo(singletonList(Imp.builder() .bidfloor(BigDecimal.valueOf(10)) .tagid("tagid") .ext(mapper.valueToTree( diff --git a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java index c4ca10d531e..92850f9f65c 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java @@ -221,7 +221,7 @@ public void processAuctionEventShouldUpdateCurrentPlan() { .extracting(lineItemId1) .extracting(lineItemId2) .extracting(lostToLineItem -> ((LostToLineItem) lostToLineItem).getCount().sum()) - .containsOnly(1L); + .isEqualTo(1L); assertThat(lineItemStatuses) .flatExtracting(LineItemStatus::getDeliveryPlans) diff --git a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java index fca5e0f4543..bea98aa2df8 100644 --- a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java +++ b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java @@ -75,7 +75,7 @@ public void hookByIdShouldReturnEntrypointHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -90,7 +90,7 @@ public void hookByIdShouldReturnRawAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -105,7 +105,7 @@ public void hookByIdShouldReturnProcessedAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -120,7 +120,7 @@ public void hookByIdShouldReturnBidderRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -135,7 +135,7 @@ public void hookByIdShouldReturnRawBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -150,7 +150,7 @@ public void hookByIdShouldReturnProcessedBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -165,7 +165,7 @@ public void hookByIdShouldReturnAuctionResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } private void givenHook(Class> clazz) { diff --git a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java index 95d6aee6d55..4a8da9abcab 100644 --- a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java +++ b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java @@ -24,7 +24,7 @@ public void createShouldReturnUsersyncerWithConcatenatedExternalAndRedirectUrl() // when and then assertThat(UsersyncerCreator.create("http://localhost:8000").apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly("http://localhost:8000/redirect-url"); + .isEqualTo("http://localhost:8000/redirect-url"); } @Test @@ -39,7 +39,7 @@ public void createShouldReturnUsersyncerWithEmptyRedirectUrlWhenItWasNotDefined( // when and then assertThat(UsersyncerCreator.create(null).apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly(""); + .isEqualTo(""); } @Test From 8dd3204b1323a18aaf7f132b97861693b3bfcf6a Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 10:21:33 +0300 Subject: [PATCH 07/25] Update test dependencies: tests refactoring to update Mockito part1 --- pom.xml | 2 +- .../MaxMindGeoLocationServiceTest.java | 19 +++++++++++++------ .../org/prebid/server/log/CriteriaTest.java | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index a4143aa3cbd..6642867c27f 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 2.23.4 + 4.0.0 3.21.0 2.27.2 4.1.0 diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index b6c8fdc596b..ed64581f875 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; +import org.mockito.internal.util.reflection.ReflectionMemberAccessor; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -75,8 +75,8 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(cityResponse); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + //FieldSetter.setField(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); @@ -96,13 +96,20 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, + IllegalAccessException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); + + //new FieldInitializer(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), FieldInitializer.ConstructorArgumentResolver.); + // + //FieldSetter.setField(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index e8374ad8280..4e5fcad3839 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } From 49d1ce3cbfd46362e564afb458c11f4e942c68a1 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 17:23:32 +0300 Subject: [PATCH 08/25] Update test dependencies: tests refactoring to update Mockito part2 revert some changes --- pom.xml | 2 +- .../MaxMindGeoLocationServiceTest.java | 15 ++++----------- .../java/org/prebid/server/log/CriteriaTest.java | 6 +++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 6642867c27f..a4143aa3cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 4.0.0 + 2.23.4 3.21.0 2.27.2 4.1.0 diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index ed64581f875..2719dd7a0a9 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.ReflectionMemberAccessor; +import org.mockito.internal.util.reflection.FieldSetter; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -96,20 +96,13 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, - IllegalAccessException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), - maxMindGeoLocationService, databaseReader); - - //new FieldInitializer(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), FieldInitializer.ConstructorArgumentResolver.); - // - //FieldSetter.setField(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + FieldSetter.setField(maxMindGeoLocationService, + maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index 4e5fcad3839..e8374ad8280 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; public class CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyNoInteractions(logger); + verifyZeroInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyNoInteractions(logger); + verifyZeroInteractions(logger); } } From 6915951d6c5385f287b6228059f697e165450284 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 18:48:58 +0300 Subject: [PATCH 09/25] Update test dependencies: tests refactoring all green --- pom.xml | 8 +++- .../PubstackAnalyticsReporterTest.java | 15 +++--- .../pubstack/PubstackEventHandlerTest.java | 4 +- .../server/auction/ExchangeServiceTest.java | 14 +++--- .../PrivacyEnforcementServiceTest.java | 4 +- .../auction/StoredRequestProcessorTest.java | 8 ++-- .../auction/StoredResponseProcessorTest.java | 6 +-- .../requestfactory/AmpRequestFactoryTest.java | 4 +- .../Ortb2RequestFactoryTest.java | 12 ++--- .../bidder/BidderErrorNotifierTest.java | 4 +- .../bidder/HttpBidderRequesterTest.java | 6 +-- .../bidder/rubicon/RubiconBidderTest.java | 4 +- .../prebid/server/cache/CacheServiceTest.java | 6 +-- .../server/cookie/UidsCookieServiceTest.java | 4 +- .../server/deals/AdminCentralServiceTest.java | 30 ++++++------ .../server/deals/AlertHttpServiceTest.java | 4 +- .../server/deals/DealsProcessorTest.java | 4 +- .../deals/DeliveryStatsServiceTest.java | 4 +- .../server/deals/RegisterServiceTest.java | 8 ++-- .../prebid/server/deals/UserServiceTest.java | 10 ++-- .../execution/RemoteFileSyncerTest.java | 18 +++---- .../MaxMindGeoLocationServiceTest.java | 15 +++--- .../server/handler/CookieSyncHandlerTest.java | 4 +- .../HttpInteractionLogHandlerTest.java | 14 +++--- .../handler/LoggerControlKnobHandlerTest.java | 12 ++--- .../handler/NotificationEventHandlerTest.java | 28 +++++------ .../SettingsCacheNotificationHandlerTest.java | 4 +- .../server/handler/VtrackHandlerTest.java | 18 +++---- .../handler/openrtb2/AmpHandlerTest.java | 10 ++-- .../handler/openrtb2/AuctionHandlerTest.java | 4 +- .../handler/openrtb2/VideoHandlerTest.java | 4 +- .../org/prebid/server/log/CriteriaTest.java | 6 +-- .../privacy/gdpr/TcfDefinerServiceTest.java | 32 ++++++------- .../FullEnforcePurposeStrategyTest.java | 48 +++++++++---------- .../SpecialFeaturesOneStrategyTest.java | 4 +- .../vendorlist/VendorListServiceV2Test.java | 4 +- .../CompositeApplicationSettingsTest.java | 10 ++-- .../settings/HttpApplicationSettingsTest.java | 6 +-- 38 files changed, 204 insertions(+), 196 deletions(-) diff --git a/pom.xml b/pom.xml index a4143aa3cbd..01af586dac2 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 2.23.4 + 4.0.0 3.21.0 2.27.2 4.1.0 @@ -400,6 +400,12 @@ ${restassured.version} test + + net.bytebuddy + byte-buddy + 1.11.19 + test + io.vertx diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java index ae43831e80b..8709a688d80 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java @@ -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 { @@ -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()); } @@ -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 @@ -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 diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java index 2ae7e4c0d7a..bf244a529a4 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java @@ -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 { @@ -88,7 +88,7 @@ public void handleShouldNotAcceptEventsWhenNotEnabled() { (AtomicReference>) ReflectionTestUtils .getField(pubstackEventHandler, "events"); assertThat(events.get()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 4bcb5e436dd..ccb9c0f813c 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -180,7 +180,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; 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; @@ -344,8 +344,8 @@ public void shouldTolerateImpWithoutExtension() { final BidResponse bidResponse = exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); // then - verifyZeroInteractions(bidderCatalog); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(bidderCatalog); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -361,7 +361,7 @@ public void shouldTolerateImpWithUnknownBidderInExtension() { // then verify(bidderCatalog).isValidName(eq("invalid")); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -500,7 +500,7 @@ public void shouldSkipBidderWhenRejectedByBidderRequestHooks() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -788,7 +788,7 @@ public void shouldNotCreateRequestForBidderRestrictedByPrivacyEnforcement() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -3061,7 +3061,7 @@ public void shouldReturnEmptyBidResponseWhenRequestIsRejected() { final Future result = exchangeService.holdAuction(auctionContext); // then - verifyZeroInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); + verifyNoInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); assertThat(result).succeededWith(BidResponse.builder() .seatbid(emptyList()) .build()); diff --git a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java index 5d25145cde2..a3fec92049a 100644 --- a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java +++ b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java @@ -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 { @@ -407,7 +407,7 @@ public void shouldMaskForCoppaWhenDeviceLmtIsEnforceAndOneAndRegsCoppaIsOneAndDo .build(); assertThat(result).isEqualTo(singletonList(expected)); - verifyZeroInteractions(tcfDefinerService); + verifyNoInteractions(tcfDefinerService); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java index 31034b72e0b..45bcc1e17af 100644 --- a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java @@ -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 { @@ -543,7 +543,7 @@ public void shouldReturnImpAndBidRequestWithoutChangesIfStoredRequestIsAbsentInP final Future 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); @@ -737,7 +737,7 @@ public void processStoredRequestsShouldNotUpdateMetricsIfApplicationSettingsFail ExtRequestPrebid.builder().storedrequest(ExtStoredRequest.of("bidRequest")).build())))); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test @@ -750,7 +750,7 @@ public void processAmpRequestShouldNotUpdateMetricsIfApplicationSettingsFailed() storedRequestProcessor.processAmpRequest(null, "123", BidRequest.builder().build()); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java index eb8db31babe..844ebb7a32b 100644 --- a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java @@ -47,7 +47,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 { @@ -110,7 +110,7 @@ public void getStoredResponseResultShouldNotChangeImpsAndReturnSeatBidsWhenThere singletonList(imp), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test @@ -132,7 +132,7 @@ public void getStoredResponseResultShouldAddImpToRequiredRequestWhenItsStoredAuc .build()), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index 500a4a0a8d4..c527bda423e 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -83,7 +83,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 { @@ -178,7 +178,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()) diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index 84d4bead9a4..87628b926f5 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -84,7 +84,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; 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 Ortb2RequestFactoryTest extends VertxTest { @@ -482,7 +482,7 @@ public void fetchAccountShouldReturnEmptyAccountIfItIsMissingInRequest() { .build()); // then - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.result()).isEqualTo(Account.empty("")); } @@ -540,7 +540,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureWhenAccountIdIsBlac // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()) @@ -579,7 +579,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureIfValidIsEnforcedAn // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -601,7 +601,7 @@ public void shouldFetchAccountFromStoredAndReturnEmptyAccountIfStoredLookupIsFai // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -617,7 +617,7 @@ public void fetchAccountWithoutStoredRequestLookupShouldNeverCallStoredProcessor .build()); // then - verifyZeroInteractions(storedRequestProcessor); + verifyNoInteractions(storedRequestProcessor); } @Test diff --git a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java index d71f2b608b4..99e5ef58be6 100644 --- a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java +++ b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java @@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 BidderErrorNotifierTest { @@ -60,7 +60,7 @@ public void shouldNotSendTimeoutNotificationWhenBidderDoesNotCreateRequest() { // then verify(bidder).makeTimeoutNotification(eq(bidderRequest)); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 634d5f30800..3608b1041fa 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -63,7 +63,7 @@ import static org.mockito.Mockito.never; 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.when; public class HttpBidderRequesterTest extends VertxTest { @@ -170,7 +170,7 @@ public void shouldPassStoredResponseToBidderMakeBidsMethodAndReturnSeatBids() { .result(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); final ArgumentCaptor> httpCallArgumentCaptor = ArgumentCaptor.forClass(HttpCall.class); verify(bidder).makeBids(httpCallArgumentCaptor.capture(), any()); assertThat(httpCallArgumentCaptor.getValue().getResponse()) @@ -612,7 +612,7 @@ public void shouldTolerateAlreadyExpiredGlobalTimeout() { assertThat(bidderSeatBid.getErrors()).hasSize(1) .extracting(BidderError::getMessage) .containsOnly("Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java index d1b8612e481..60009349dbb 100644 --- a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java @@ -113,7 +113,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; import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; import static org.prebid.server.proto.openrtb.ext.response.BidType.video; @@ -537,7 +537,7 @@ public void makeHttpRequestsShouldNotSetBidFloorCurrencyToUSDIfNull() { final Result>> result = rubiconBidder.makeHttpRequests(bidRequest); // then - verifyZeroInteractions(currencyConversionService); + verifyNoInteractions(currencyConversionService); assertThat(result.getErrors()).hasSize(1) .containsOnly(BidderError.of("Imp `impId` floor provided with no currency, assuming USD", BidderError.Type.bad_input)); diff --git a/src/test/java/org/prebid/server/cache/CacheServiceTest.java b/src/test/java/org/prebid/server/cache/CacheServiceTest.java index 7af0cdcb3a7..b050c9e002a 100644 --- a/src/test/java/org/prebid/server/cache/CacheServiceTest.java +++ b/src/test/java/org/prebid/server/cache/CacheServiceTest.java @@ -71,7 +71,7 @@ import static org.mockito.Mockito.eq; 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 CacheServiceTest extends VertxTest { @@ -176,7 +176,7 @@ public void cacheBidsOpenrtbShouldNeverCallCacheServiceIfNoBidsPassed() { cacheService.cacheBidsOpenrtb(emptyList(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -762,7 +762,7 @@ public void cachePutObjectsShouldReturnResultWithEmptyListWhenPutObjectsIsEmpty( emptySet(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(result.result().getResponses()).isEmpty(); } diff --git a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java index 8a8ab3d418a..a66ed086899 100644 --- a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java +++ b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.within; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class UidsCookieServiceTest extends VertxTest { @@ -382,7 +382,7 @@ public void shouldNotReadHostCookieIfNameNotSpecified() { final String hostCookie = uidsCookieService.parseHostCookie(emptyMap()); // then - verifyZeroInteractions(routingContext); + verifyNoInteractions(routingContext); assertThat(hostCookie).isNull(); } diff --git a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java index 22fa213ec11..6be2ee7e4ee 100644 --- a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.eq; 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 AdminCentralServiceTest extends VertxTest { @@ -119,7 +119,7 @@ public void processAdminCentralEventShouldNotStopServicesWhenServicesCommandIsNo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(suspendable); + verifyNoInteractions(suspendable); } @Test @@ -147,7 +147,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenCommandIsNul adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -161,7 +161,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenItIsNotStart adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -174,8 +174,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCommandWasNotD adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -188,8 +188,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenBodyWasNotDefi adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -202,8 +202,8 @@ public void processAdminCentralEventShouldCallSettings() { adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -244,7 +244,7 @@ public void processAdminCentralEventShouldNotCallAmpSettingsCacheWhenCantParseBo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -292,7 +292,7 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCantParseBody( adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); + verifyNoInteractions(settingsCache); } @Test @@ -375,7 +375,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenCommandIs adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -389,7 +389,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenInvalidCo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -403,7 +403,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsCantParseBody adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java index af9af63f06e..9bbc5967cd0 100644 --- a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java @@ -35,7 +35,7 @@ import static org.mockito.BDDMockito.given; 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 AlertHttpServiceTest extends VertxTest { @@ -80,7 +80,7 @@ public void alertShouldNotSendAlertWhenServiceIsNotEnabled() { alertHttpService.alert("pbs", AlertPriority.HIGH, "errorMessage"); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java index 0530fba389b..6620498ccc5 100644 --- a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java +++ b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java @@ -67,7 +67,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 DealsProcessorTest extends VertxTest { @@ -894,7 +894,7 @@ public void populateDealsInfoShouldUseGeoInfoFromContext() { assertThat(result.getBidRequest().getDevice()).isEqualTo(Device.builder() .geo(Geo.builder().ext(expectedExtGeo).build()) .build()); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); assertThat(result.getGeoInfo()).isSameAs(geoInfo); } diff --git a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java index 7cfa3dedaa4..25f7193ea9d 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java @@ -52,7 +52,7 @@ import static org.mockito.BDDMockito.given; 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 DeliveryStatsServiceTest extends VertxTest { @@ -349,7 +349,7 @@ public void suspendShouldSetSuspendFlagAndReportShouldNotBeSent() { deliveryStatsService.sendDeliveryProgressReports(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java index 139bc81234b..4b152236882 100644 --- a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java +++ b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.never; 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 RegisterServiceTest extends VertxTest { @@ -155,7 +155,7 @@ public void registerShouldNotCallAdminCentralWhenResponseIsEmpty() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -185,7 +185,7 @@ public void registerShouldNotCallAdminCentralWhenFutureFailed() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -229,7 +229,7 @@ public void registerShouldNotSendAdminEventWhenResponseStatusIsBadRequest() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test diff --git a/src/test/java/org/prebid/server/deals/UserServiceTest.java b/src/test/java/org/prebid/server/deals/UserServiceTest.java index 9484314d101..9ef73deeae4 100644 --- a/src/test/java/org/prebid/server/deals/UserServiceTest.java +++ b/src/test/java/org/prebid/server/deals/UserServiceTest.java @@ -64,7 +64,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 UserServiceTest extends VertxTest { @@ -131,7 +131,7 @@ public void getUserDetailsShouldReturnEmptyUserDetailsWhenUidsAreEmpty() { // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -157,7 +157,7 @@ public void getUserDetailsShouldReturnReturnEmptyUserDetailsWhenUidsDoesNotConta // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -476,7 +476,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -498,7 +498,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java index 157d4cdc717..b571e897f11 100644 --- a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java +++ b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @SuppressWarnings("ResultOfMethodCallIgnored") @@ -168,8 +168,8 @@ public void syncForFilepathShouldNotTriggerServiceWhenCantCheckIfUsableFileExist // then verify(fileSystem).exists(eq(FILE_PATH), any()); - verifyZeroInteractions(remoteFileProcessor); - verifyZeroInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); } @Test @@ -190,7 +190,7 @@ public void syncForFilepathShouldRetryWhenRemoteFileProcessorIsFailed() { verify(fileSystem, times(2)).exists(eq(FILE_PATH), any()); verify(remoteFileProcessor, times(1)).setDataPath(FILE_PATH); verify(fileSystem).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -350,8 +350,8 @@ public void syncForFilepathShouldRetryAfterFailedDownload() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 1)).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -380,8 +380,8 @@ public void syncForFilepathShouldRetryWhenDeleteFileIsFailed() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 2)).delete(eq(TMP_FILE_PATH), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -461,7 +461,7 @@ public void syncForFilepathShouldRetryWhenTimeoutIsReached() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(TIMEOUT), any()); verify(asyncFile, times(RETRY_COUNT + 1)).close(); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(remoteFileProcessor); } private void givenTriggerUpdate() { diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index 2719dd7a0a9..ad3ccb1172d 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; +import org.mockito.internal.util.reflection.ReflectionMemberAccessor; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -60,7 +60,7 @@ public void setDatabaseReaderShouldReturnFailedFutureIfDatabaseArchiveNotFound() @Test public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuchFieldException, IOException, - GeoIp2Exception { + GeoIp2Exception, IllegalAccessException { // given final Country country = new Country(null, null, null, "fr", null); final Continent continent = new Continent(null, "eu", null, null); @@ -75,8 +75,8 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(cityResponse); - //FieldSetter.setField(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); @@ -96,13 +96,14 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, + IllegalAccessException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java index 3bc380ce940..e8c1e5ceeec 100644 --- a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java @@ -77,7 +77,7 @@ import static org.mockito.Mockito.never; 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 CookieSyncHandlerTest extends VertxTest { @@ -1105,7 +1105,7 @@ public void shouldTolerateMissingTcfParamsInRequestForUsersyncInfo() throws IOEx .extracting(bidderStatus -> bidderStatus.getUsersync().getUrl()) .containsOnly("http://adnxsexample.com/sync?gdpr=&gdpr_consent="); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java index 0720b9e0b2e..3ac0f223ba1 100644 --- a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java @@ -17,7 +17,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 HttpInteractionLogHandlerTest { @@ -89,7 +89,7 @@ public void shouldRespondWithErrorWhenEndpointNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'endpoint' parameter value, allowed values '[auction, amp]'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -106,7 +106,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'statusCode' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -123,7 +123,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'statusCode' must be between 200 and 500")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -138,7 +138,7 @@ public void shouldRespondWithErrorWhenLimitAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'limit'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -154,7 +154,7 @@ public void shouldRespondWithErrorWhenLimitNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'limit' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -170,6 +170,6 @@ public void shouldRespondWithErrorWhenLimitNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'limit' must be between 0 and 5")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } } diff --git a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java index ed89808f92c..a215571e475 100644 --- a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java @@ -18,7 +18,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 LoggerControlKnobHandlerTest { @@ -72,7 +72,7 @@ public void shouldRespondWithErrorWhenLevelAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'level'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -88,7 +88,7 @@ public void shouldRespondWithErrorWhenLevelNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'level' parameter value, allowed values '[warn, debug, error, info]'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -104,7 +104,7 @@ public void shouldRespondWithErrorWhenDurationAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'duration'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -121,7 +121,7 @@ public void shouldRespondWithErrorWhenDurationNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'duration' parameter value")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -138,6 +138,6 @@ public void shouldRespondWithErrorWhenDurationNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'duration' must be between 0 and 10000")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } } diff --git a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java index 88af2a7ab8f..f1253e8099a 100644 --- a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java @@ -44,7 +44,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 NotificationEventHandlerTest extends VertxTest { @@ -100,7 +100,7 @@ public void shouldReturnBadRequestWhenTypeIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -116,7 +116,7 @@ public void shouldReturnBadRequestWhenTypeIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -132,7 +132,7 @@ public void shouldReturnBadRequestWhenBidIdIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -150,7 +150,7 @@ public void shouldReturnBadRequestWhenTimestampIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -167,7 +167,7 @@ public void shouldReturnUnauthorizedWhenAccountIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); } @@ -185,7 +185,7 @@ public void shouldReturnBadRequestWhenFormatValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -204,7 +204,7 @@ public void shouldReturnBadRequestWhenAnalyticsValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -224,7 +224,7 @@ public void shouldReturnBadRequestWhenIntegrationValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -244,7 +244,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountNotFound() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -270,7 +270,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountEventNotEnabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -419,8 +419,8 @@ public void shouldNotProcessLineItemEventWhenDealsDisabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(applicationEventService); - verifyZeroInteractions(userService); + verifyNoInteractions(applicationEventService); + verifyNoInteractions(userService); } @Test @@ -443,7 +443,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAnalyticsValueIsZero() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); } @Test diff --git a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java index deaffcef38d..e8aa1cb8925 100644 --- a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java @@ -23,7 +23,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 SettingsCacheNotificationHandlerTest extends VertxTest { @@ -151,6 +151,6 @@ public void shouldReturnMethodNotAllowedStatusResponseIfRequestHasNeitherPostOrD // then verify(httpResponse).setStatusCode(eq(405)); - verifyZeroInteractions(cacheNotificationListener); + verifyNoInteractions(cacheNotificationListener); } } diff --git a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java index 42deb16a373..42381b41c0c 100644 --- a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java @@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 VtrackHandlerTest extends VertxTest { @@ -95,7 +95,7 @@ public void shouldRespondWithBadRequestWhenAccountParameterIsMissing() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Account 'a' is required query parameter and can't be empty")); @@ -119,7 +119,7 @@ public void shouldRespondWithBadRequestWhenBodyIsEmpty() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Incoming request has no body")); @@ -134,7 +134,7 @@ public void shouldRespondWithBadRequestWhenBodyCannotBeParsed() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Failed to parse request body")); @@ -150,7 +150,7 @@ public void shouldRespondWithBadRequestWhenBidIdIsMissing() throws JsonProcessin handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidid' is required field and can't be empty")); @@ -166,7 +166,7 @@ public void shouldRespondWithBadRequestWhenBidderIsMissing() throws JsonProcessi handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidder' is required field and can't be empty")); @@ -182,7 +182,7 @@ public void shouldRespondWithBadRequestWhenTypeIsNotXML() throws JsonProcessingE handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack only accepts type xml")); @@ -201,7 +201,7 @@ public void shouldRespondWithBadRequestWhenValueDoesNotContainVast() throws Json handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack content must be vast")); @@ -224,7 +224,7 @@ public void shouldRespondWithInternalServerErrorWhenFetchingAccountFails() throw handler.handle(routingContext); // then - verifyZeroInteractions(cacheService); + verifyNoInteractions(cacheService); verify(httpResponse).setStatusCode(eq(500)); verify(httpResponse).end(eq("Error occurred while fetching account: error")); diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java index 6f9c090650b..73aeb891e14 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java @@ -80,7 +80,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AmpHandlerTest extends VertxTest { @@ -192,7 +192,7 @@ public void shouldRespondWithBadRequestIfRequestIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(400)); assertThat(httpResponse.headers()).hasSize(2) @@ -213,7 +213,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedAccount() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -233,7 +233,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedApp() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -253,7 +253,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java index 038f5c723d4..44f2eafb030 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java @@ -69,7 +69,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AuctionHandlerTest extends VertxTest { @@ -233,7 +233,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { auctionHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java index 3eb31e4a11a..a61a47f23c1 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class VideoHandlerTest extends VertxTest { @@ -161,7 +161,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { videoHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Unauthorised: Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index e8374ad8280..4e5fcad3839 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } diff --git a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java index 2d2ba53a759..18ab0b012bf 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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 TcfDefinerServiceTest { @@ -115,8 +115,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabled() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -133,8 +133,8 @@ public void resolveTcfContextShouldReturnContextWithGdprZeroWhenGdprIsDisabledBy // then assertThat(result).succeededWith(TcfContext.builder().build()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -149,8 +149,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabledByAccount() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -168,8 +168,8 @@ public void resolveTcfContextShouldCheckAccountConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -197,8 +197,8 @@ public void resolveTcfContextShouldCheckServiceConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -270,7 +270,7 @@ public void resolveTcfContextShouldConsiderPresenceOfConsentStringAsInScope() { true, null, null, null); assertThat(result.result().getConsent()).isNotNull(); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfRequestsMetric(2); verify(metrics).updatePrivacyTcfGeoMetric(2, null); } @@ -292,7 +292,7 @@ public void resolveTcfContextShouldReturnGdprFromCountryWhenGdprFromRequestIsNot TcfContext::getIpAddress) .containsExactly("1", "consent", null, true, "ip"); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfGeoMetric(2, true); } @@ -394,7 +394,7 @@ public void resolveTcfContextShouldConsultDefaultValueAndSkipGeoLookupWhenIpIsNu TcfContext::getIpAddress) .containsExactly("0", null, null, null, null); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); } @Test @@ -476,7 +476,7 @@ public void resultForVendorIdsShouldAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap(1, PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test @@ -504,7 +504,7 @@ public void resultForBidderNamesShouldReturnAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap("b1", PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java index 3c4d88ebc41..977d486bc07 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java @@ -30,7 +30,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class FullEnforcePurposeStrategyTest { @@ -242,7 +242,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndRequireLI() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -267,7 +267,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowed() { assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -319,7 +319,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndVendorLIAllowe assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // GVL Legitimate interest Purpose part @@ -398,7 +398,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndRequireConsent() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -451,7 +451,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndVendorConsen assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose part @@ -535,7 +535,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowedAndFlexibleAndRequireC // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -562,8 +562,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorLIAllowedAndEnforced // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -643,7 +643,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndFlexibleAndReq // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -670,8 +670,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorConsentAndEnfor // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -753,7 +753,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorLIAllowedAndEnf assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -781,7 +781,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorConsentAllowedAndEnf assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose Legitimate interest part @@ -865,7 +865,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAllowedAndFlexibleAndRequir // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -892,8 +892,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorLIAllowedAndEnforc // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -921,7 +921,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAndEnforced assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -949,7 +949,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAndEnforced assertThat(result).isEmpty(); verify(allowedVendors).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // Restriction type is REQUIRE_LEGITIMATE_INTEREST part @@ -977,7 +977,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndFlexibleAndR // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1004,8 +1004,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorConsentAndEnf // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -1087,7 +1087,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAllowedAndE assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1115,7 +1115,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAllowedAndE assertThat(result).isEmpty(); verify(purposesLI).contains(1); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java index 9b230593859..67b176a63c8 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java @@ -22,7 +22,7 @@ import static org.mockito.ArgumentMatchers.anyInt; 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 SpecialFeaturesOneStrategyTest { @@ -83,7 +83,7 @@ public void processSpecialFeaturesStrategyShouldAllowForAllWhenIsNotEnforced() { assertThat(result).usingFieldByFieldElementComparator().containsOnly(vendorPermission1Changed, vendorPermission2Changed); - verifyZeroInteractions(specialFeatureOptIns); + verifyNoInteractions(specialFeatureOptIns); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java index e21cfadf86a..8426f478d68 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.ONE; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.TWO; @@ -145,7 +145,7 @@ public void shouldStartUsingFallbackVersionIfDeprecatedIsTrue() { final Future> future = vendorListService.forVersion(1); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(future).succeededWith(singletonMap( 52, VendorV2.builder() .id(52) diff --git a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java index 4230a5308cc..2597ecad758 100644 --- a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CompositeApplicationSettingsTest { @@ -75,7 +75,7 @@ public void getAccountByIdShouldReturnAccountFromFirstDelegateIfPresent() { // then assertThat(future.succeeded()).isTrue(); assertThat(future.result()).isSameAs(account); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -138,7 +138,7 @@ public void getStoredDataShouldReturnResultFromFirstDelegateIfPresent() { .containsOnly(entry("key1", "value1")); assertThat(future.result().getStoredIdToImp()).hasSize(1) .containsOnly(entry("key2", "value2")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -261,7 +261,7 @@ public void getAmpStoredDataShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -371,7 +371,7 @@ public void getStoredResponsesShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getIdToStoredResponses()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test diff --git a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java index f77f302f781..d598c0bf13c 100644 --- a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class HttpApplicationSettingsTest extends VertxTest { @@ -207,7 +207,7 @@ public void getStoredDataShouldReturnEmptyResultIfEmptyRequestsIdsGiven() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).isEmpty(); assertThat(future.result().getStoredIdToImp()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -222,7 +222,7 @@ public void getStoredDataShouldReturnResultWithErrorIfTimeoutAlreadyExpired() { assertThat(future.result().getStoredIdToImp()).isEmpty(); assertThat(future.result().getErrors()) .containsOnly("Error fetching stored requests for ids [id1] via HTTP: Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test From 55ffc6fb73be377ff8616de17cc524208898c811 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 19:13:30 +0300 Subject: [PATCH 10/25] Move bytebuddy dependency version to appropriate place --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 01af586dac2..c113aaeae5b 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ 9.4.43.v20210629 3.0.7 1.4.200 + 1.11.19 3.1.0 @@ -403,7 +404,7 @@ net.bytebuddy byte-buddy - 1.11.19 + ${bytebuddy.version} test From 3920ef7ac2c899135fc3a68af486ca9194607a1c Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Tue, 5 Oct 2021 15:18:41 +0300 Subject: [PATCH 11/25] Adds that video ads are returned as VAST wrappers via the 'adm' field in addition to being returned as plain URLs via the 'nurl' field. --- .../prebid/server/bidder/yieldlab/YieldlabBidderTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index 49e7c54bf07..e7cdb224eeb 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -232,9 +232,11 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio // then final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); - final String adm = String.format( - "", - timestamp); + final String adm = "" + + "Yieldlab" + + "" + + "" + + ""; final BidderBid expected = BidderBid.of( Bid.builder() .id("1") From ca1d066fa39f8f2cadccfddacb1aeb9e446dc081 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Wed, 6 Oct 2021 16:50:17 +0300 Subject: [PATCH 12/25] this commit will check adm with nurl inside it --- .../prebid/server/bidder/yieldlab/YieldlabBidderTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java index e7cdb224eeb..49e7c54bf07 100644 --- a/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/yieldlab/YieldlabBidderTest.java @@ -232,11 +232,9 @@ public void makeBidsShouldReturnCorrectBidderBid() throws JsonProcessingExceptio // then final String timestamp = String.valueOf((int) Instant.now().getEpochSecond()); final int weekNumber = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); - final String adm = "" + - "Yieldlab" + - "" + - "" + - ""; + final String adm = String.format( + "", + timestamp); final BidderBid expected = BidderBid.of( Bid.builder() .id("1") From c6930a00c37262068fe8f989a9b8aed0d8e2ac10 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Thu, 7 Oct 2021 23:40:05 +0300 Subject: [PATCH 13/25] Update test dependencies: tests refactoring to update AssertJ --- pom.xml | 12 ++++++------ .../prebid/server/auction/ExchangeServiceTest.java | 12 ++++++------ .../requestfactory/AmpRequestFactoryTest.java | 2 +- .../Ortb2ImplicitParametersResolverTest.java | 4 ++-- .../requestfactory/Ortb2RequestFactoryTest.java | 2 +- .../server/bidder/HttpBidderRequesterTest.java | 2 +- .../server/bidder/appnexus/AppnexusBidderTest.java | 4 ++-- .../server/deals/DeliveryProgressServiceTest.java | 2 +- .../server/hooks/execution/HookCatalogTest.java | 14 +++++++------- .../config/bidder/util/UsersyncerCreatorTest.java | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index a2b9873c30b..a4143aa3cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -47,14 +47,14 @@ 2.12.0 - 4.13.1 + 4.13.2 2.23.4 - 3.8.0 - 2.26.3 - 4.0.1 + 3.21.0 + 2.27.2 + 4.1.0 9.4.43.v20210629 - 3.0.6 - 1.4.196 + 3.0.7 + 1.4.200 3.1.0 diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 6c41cf013e5..fc8735c3d9d 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -667,7 +667,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 bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); @@ -677,7 +677,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"))); } @@ -1787,7 +1787,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")); } @@ -1807,7 +1807,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)); } @@ -2481,10 +2481,10 @@ public void shouldRemoveSiteIfBothSiteAndAppPresent() { final BidRequest captureBidRequest = captureBidRequest(); assertThat(captureBidRequest) .extracting(BidRequest::getSite) - .containsNull(); + .isNull(); assertThat(captureBidRequest) .extracting(BidRequest::getApp) - .doesNotContainNull(); + .isNotNull(); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index 508d4708d3f..c9ca79b0800 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -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())); } diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java index 061fd22e721..ea2f8b6000e 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java @@ -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 @@ -1628,7 +1628,7 @@ public void shouldSetDefaultIncludeBidderKeysToFalseIfIncludeBidderKeysIsMissedA // then assertThat(result.getExt()) .extracting(extBidRequest -> extBidRequest.getPrebid().getTargeting().getIncludebidderkeys()) - .containsOnly(false); + .isEqualTo(false); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index b99bca34fbc..439197a0cf2 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -809,7 +809,7 @@ public void enrichBidRequestWithAccountAndPrivacyDataShouldReturnIntegrationFrom // then assertThat(result) .extracting(auctionBidRequest -> auctionBidRequest.getExt().getPrebid().getIntegration()) - .containsOnly(integration); + .isEqualTo(integration); } @Test diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 3570a9f6b6f..634d5f30800 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -175,7 +175,7 @@ public void shouldPassStoredResponseToBidderMakeBidsMethodAndReturnSeatBids() { verify(bidder).makeBids(httpCallArgumentCaptor.capture(), any()); assertThat(httpCallArgumentCaptor.getValue().getResponse()) .extracting(HttpResponse::getBody) - .containsOnly("storedResponse"); + .isEqualTo("storedResponse"); assertThat(bidderSeatBid.getBids()).containsOnlyElementsOf(bids); } diff --git a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java index 53217e24c59..3d0171932b2 100644 --- a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java @@ -478,8 +478,8 @@ public void makeHttpRequestsShouldSetImpTagidAndImpBidFloorIfExtImpAppnexusHasIn // then assertThat(result.getValue()).hasSize(1) .extracting(res -> mapper.readValue(res.getBody(), BidRequest.class)) - .element(0).extracting(BidRequest::getImp).hasSize(1) - .containsOnly(singletonList(Imp.builder() + .element(0).extracting(BidRequest::getImp) + .isEqualTo(singletonList(Imp.builder() .bidfloor(BigDecimal.valueOf(10)) .tagid("tagid") .ext(mapper.valueToTree( diff --git a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java index c4ca10d531e..92850f9f65c 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java @@ -221,7 +221,7 @@ public void processAuctionEventShouldUpdateCurrentPlan() { .extracting(lineItemId1) .extracting(lineItemId2) .extracting(lostToLineItem -> ((LostToLineItem) lostToLineItem).getCount().sum()) - .containsOnly(1L); + .isEqualTo(1L); assertThat(lineItemStatuses) .flatExtracting(LineItemStatus::getDeliveryPlans) diff --git a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java index fca5e0f4543..bea98aa2df8 100644 --- a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java +++ b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java @@ -75,7 +75,7 @@ public void hookByIdShouldReturnEntrypointHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -90,7 +90,7 @@ public void hookByIdShouldReturnRawAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -105,7 +105,7 @@ public void hookByIdShouldReturnProcessedAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -120,7 +120,7 @@ public void hookByIdShouldReturnBidderRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -135,7 +135,7 @@ public void hookByIdShouldReturnRawBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -150,7 +150,7 @@ public void hookByIdShouldReturnProcessedBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -165,7 +165,7 @@ public void hookByIdShouldReturnAuctionResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } private void givenHook(Class> clazz) { diff --git a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java index 95d6aee6d55..4a8da9abcab 100644 --- a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java +++ b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java @@ -24,7 +24,7 @@ public void createShouldReturnUsersyncerWithConcatenatedExternalAndRedirectUrl() // when and then assertThat(UsersyncerCreator.create("http://localhost:8000").apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly("http://localhost:8000/redirect-url"); + .isEqualTo("http://localhost:8000/redirect-url"); } @Test @@ -39,7 +39,7 @@ public void createShouldReturnUsersyncerWithEmptyRedirectUrlWhenItWasNotDefined( // when and then assertThat(UsersyncerCreator.create(null).apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly(""); + .isEqualTo(""); } @Test From cf4c70227fd6e697f32018a0a9da413776eb7604 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 10:21:33 +0300 Subject: [PATCH 14/25] Update test dependencies: tests refactoring to update Mockito part1 --- pom.xml | 2 +- .../MaxMindGeoLocationServiceTest.java | 19 +++++++++++++------ .../org/prebid/server/log/CriteriaTest.java | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index a4143aa3cbd..6642867c27f 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 2.23.4 + 4.0.0 3.21.0 2.27.2 4.1.0 diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index b6c8fdc596b..ed64581f875 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; +import org.mockito.internal.util.reflection.ReflectionMemberAccessor; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -75,8 +75,8 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(cityResponse); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + //FieldSetter.setField(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); @@ -96,13 +96,20 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, + IllegalAccessException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); + + //new FieldInitializer(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), FieldInitializer.ConstructorArgumentResolver.); + // + //FieldSetter.setField(maxMindGeoLocationService, + //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index e8374ad8280..4e5fcad3839 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } From 2522c6a6adb4efa6b8b743a4c49a19893fd76ee5 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 17:23:32 +0300 Subject: [PATCH 15/25] Update test dependencies: tests refactoring to update Mockito part2 revert some changes --- pom.xml | 2 +- .../MaxMindGeoLocationServiceTest.java | 15 ++++----------- .../java/org/prebid/server/log/CriteriaTest.java | 6 +++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 6642867c27f..a4143aa3cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 4.0.0 + 2.23.4 3.21.0 2.27.2 4.1.0 diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index ed64581f875..2719dd7a0a9 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.ReflectionMemberAccessor; +import org.mockito.internal.util.reflection.FieldSetter; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -96,20 +96,13 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, - IllegalAccessException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), - maxMindGeoLocationService, databaseReader); - - //new FieldInitializer(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), FieldInitializer.ConstructorArgumentResolver.); - // - //FieldSetter.setField(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + FieldSetter.setField(maxMindGeoLocationService, + maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index 4e5fcad3839..e8374ad8280 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; public class CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyNoInteractions(logger); + verifyZeroInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyNoInteractions(logger); + verifyZeroInteractions(logger); } } From a3e34e7f45285b012554c897d9e2a3100dad2f09 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 18:48:58 +0300 Subject: [PATCH 16/25] Update test dependencies: tests refactoring all green --- pom.xml | 8 +++- .../PubstackAnalyticsReporterTest.java | 15 +++--- .../pubstack/PubstackEventHandlerTest.java | 4 +- .../server/auction/ExchangeServiceTest.java | 14 +++--- .../PrivacyEnforcementServiceTest.java | 4 +- .../auction/StoredRequestProcessorTest.java | 8 ++-- .../auction/StoredResponseProcessorTest.java | 6 +-- .../requestfactory/AmpRequestFactoryTest.java | 4 +- .../Ortb2RequestFactoryTest.java | 12 ++--- .../bidder/BidderErrorNotifierTest.java | 4 +- .../bidder/HttpBidderRequesterTest.java | 6 +-- .../bidder/rubicon/RubiconBidderTest.java | 4 +- .../prebid/server/cache/CacheServiceTest.java | 6 +-- .../server/cookie/UidsCookieServiceTest.java | 4 +- .../server/deals/AdminCentralServiceTest.java | 30 ++++++------ .../server/deals/AlertHttpServiceTest.java | 4 +- .../server/deals/DealsProcessorTest.java | 4 +- .../deals/DeliveryStatsServiceTest.java | 4 +- .../server/deals/RegisterServiceTest.java | 8 ++-- .../prebid/server/deals/UserServiceTest.java | 10 ++-- .../execution/RemoteFileSyncerTest.java | 18 +++---- .../MaxMindGeoLocationServiceTest.java | 15 +++--- .../server/handler/CookieSyncHandlerTest.java | 4 +- .../HttpInteractionLogHandlerTest.java | 14 +++--- .../handler/LoggerControlKnobHandlerTest.java | 12 ++--- .../handler/NotificationEventHandlerTest.java | 28 +++++------ .../SettingsCacheNotificationHandlerTest.java | 4 +- .../server/handler/VtrackHandlerTest.java | 18 +++---- .../handler/openrtb2/AmpHandlerTest.java | 10 ++-- .../handler/openrtb2/AuctionHandlerTest.java | 4 +- .../handler/openrtb2/VideoHandlerTest.java | 4 +- .../org/prebid/server/log/CriteriaTest.java | 6 +-- .../privacy/gdpr/TcfDefinerServiceTest.java | 32 ++++++------- .../FullEnforcePurposeStrategyTest.java | 48 +++++++++---------- .../SpecialFeaturesOneStrategyTest.java | 4 +- .../vendorlist/VendorListServiceV2Test.java | 4 +- .../CompositeApplicationSettingsTest.java | 10 ++-- .../settings/HttpApplicationSettingsTest.java | 6 +-- 38 files changed, 204 insertions(+), 196 deletions(-) diff --git a/pom.xml b/pom.xml index a4143aa3cbd..01af586dac2 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.13.2 - 2.23.4 + 4.0.0 3.21.0 2.27.2 4.1.0 @@ -400,6 +400,12 @@ ${restassured.version} test + + net.bytebuddy + byte-buddy + 1.11.19 + test + io.vertx diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java index ae43831e80b..8709a688d80 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java @@ -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 { @@ -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()); } @@ -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 @@ -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 diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java index 2ae7e4c0d7a..bf244a529a4 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java @@ -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 { @@ -88,7 +88,7 @@ public void handleShouldNotAcceptEventsWhenNotEnabled() { (AtomicReference>) ReflectionTestUtils .getField(pubstackEventHandler, "events"); assertThat(events.get()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index fc8735c3d9d..97afd1c8e62 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -183,7 +183,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; 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; @@ -351,8 +351,8 @@ public void shouldTolerateImpWithoutExtension() { final BidResponse bidResponse = exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); // then - verifyZeroInteractions(bidderCatalog); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(bidderCatalog); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -368,7 +368,7 @@ public void shouldTolerateImpWithUnknownBidderInExtension() { // then verify(bidderCatalog).isValidName(eq("invalid")); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -507,7 +507,7 @@ public void shouldSkipBidderWhenRejectedByBidderRequestHooks() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -796,7 +796,7 @@ public void shouldNotCreateRequestForBidderRestrictedByPrivacyEnforcement() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -3253,7 +3253,7 @@ public void shouldReturnEmptyBidResponseWhenRequestIsRejected() { final Future result = exchangeService.holdAuction(auctionContext); // then - verifyZeroInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); + verifyNoInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); assertThat(result).succeededWith(BidResponse.builder() .seatbid(emptyList()) .build()); diff --git a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java index 918de53824c..9bec2a50064 100644 --- a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java +++ b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java @@ -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 { @@ -407,7 +407,7 @@ public void shouldMaskForCoppaWhenDeviceLmtIsEnforceAndOneAndRegsCoppaIsOneAndDo .build(); assertThat(result).isEqualTo(singletonList(expected)); - verifyZeroInteractions(tcfDefinerService); + verifyNoInteractions(tcfDefinerService); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java index 31034b72e0b..45bcc1e17af 100644 --- a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java @@ -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 { @@ -543,7 +543,7 @@ public void shouldReturnImpAndBidRequestWithoutChangesIfStoredRequestIsAbsentInP final Future 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); @@ -737,7 +737,7 @@ public void processStoredRequestsShouldNotUpdateMetricsIfApplicationSettingsFail ExtRequestPrebid.builder().storedrequest(ExtStoredRequest.of("bidRequest")).build())))); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test @@ -750,7 +750,7 @@ public void processAmpRequestShouldNotUpdateMetricsIfApplicationSettingsFailed() storedRequestProcessor.processAmpRequest(null, "123", BidRequest.builder().build()); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java index eb8db31babe..844ebb7a32b 100644 --- a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java @@ -47,7 +47,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 { @@ -110,7 +110,7 @@ public void getStoredResponseResultShouldNotChangeImpsAndReturnSeatBidsWhenThere singletonList(imp), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test @@ -132,7 +132,7 @@ public void getStoredResponseResultShouldAddImpToRequiredRequestWhenItsStoredAuc .build()), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index c9ca79b0800..c41a6b8543a 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -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 { @@ -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()) diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index 439197a0cf2..1219fa7ddb8 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -84,7 +84,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; 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 Ortb2RequestFactoryTest extends VertxTest { @@ -482,7 +482,7 @@ public void fetchAccountShouldReturnEmptyAccountIfItIsMissingInRequest() { .build()); // then - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.result()).isEqualTo(Account.empty("")); } @@ -540,7 +540,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureWhenAccountIdIsBlac // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()) @@ -579,7 +579,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureIfValidIsEnforcedAn // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -601,7 +601,7 @@ public void shouldFetchAccountFromStoredAndReturnEmptyAccountIfStoredLookupIsFai // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -617,7 +617,7 @@ public void fetchAccountWithoutStoredRequestLookupShouldNeverCallStoredProcessor .build()); // then - verifyZeroInteractions(storedRequestProcessor); + verifyNoInteractions(storedRequestProcessor); } @Test diff --git a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java index d71f2b608b4..99e5ef58be6 100644 --- a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java +++ b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java @@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 BidderErrorNotifierTest { @@ -60,7 +60,7 @@ public void shouldNotSendTimeoutNotificationWhenBidderDoesNotCreateRequest() { // then verify(bidder).makeTimeoutNotification(eq(bidderRequest)); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 634d5f30800..3608b1041fa 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -63,7 +63,7 @@ import static org.mockito.Mockito.never; 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.when; public class HttpBidderRequesterTest extends VertxTest { @@ -170,7 +170,7 @@ public void shouldPassStoredResponseToBidderMakeBidsMethodAndReturnSeatBids() { .result(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); final ArgumentCaptor> httpCallArgumentCaptor = ArgumentCaptor.forClass(HttpCall.class); verify(bidder).makeBids(httpCallArgumentCaptor.capture(), any()); assertThat(httpCallArgumentCaptor.getValue().getResponse()) @@ -612,7 +612,7 @@ public void shouldTolerateAlreadyExpiredGlobalTimeout() { assertThat(bidderSeatBid.getErrors()).hasSize(1) .extracting(BidderError::getMessage) .containsOnly("Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java index d1b8612e481..60009349dbb 100644 --- a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java @@ -113,7 +113,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; import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; import static org.prebid.server.proto.openrtb.ext.response.BidType.video; @@ -537,7 +537,7 @@ public void makeHttpRequestsShouldNotSetBidFloorCurrencyToUSDIfNull() { final Result>> result = rubiconBidder.makeHttpRequests(bidRequest); // then - verifyZeroInteractions(currencyConversionService); + verifyNoInteractions(currencyConversionService); assertThat(result.getErrors()).hasSize(1) .containsOnly(BidderError.of("Imp `impId` floor provided with no currency, assuming USD", BidderError.Type.bad_input)); diff --git a/src/test/java/org/prebid/server/cache/CacheServiceTest.java b/src/test/java/org/prebid/server/cache/CacheServiceTest.java index 7af0cdcb3a7..b050c9e002a 100644 --- a/src/test/java/org/prebid/server/cache/CacheServiceTest.java +++ b/src/test/java/org/prebid/server/cache/CacheServiceTest.java @@ -71,7 +71,7 @@ import static org.mockito.Mockito.eq; 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 CacheServiceTest extends VertxTest { @@ -176,7 +176,7 @@ public void cacheBidsOpenrtbShouldNeverCallCacheServiceIfNoBidsPassed() { cacheService.cacheBidsOpenrtb(emptyList(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -762,7 +762,7 @@ public void cachePutObjectsShouldReturnResultWithEmptyListWhenPutObjectsIsEmpty( emptySet(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(result.result().getResponses()).isEmpty(); } diff --git a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java index 8a8ab3d418a..a66ed086899 100644 --- a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java +++ b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.within; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class UidsCookieServiceTest extends VertxTest { @@ -382,7 +382,7 @@ public void shouldNotReadHostCookieIfNameNotSpecified() { final String hostCookie = uidsCookieService.parseHostCookie(emptyMap()); // then - verifyZeroInteractions(routingContext); + verifyNoInteractions(routingContext); assertThat(hostCookie).isNull(); } diff --git a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java index 22fa213ec11..6be2ee7e4ee 100644 --- a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.eq; 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 AdminCentralServiceTest extends VertxTest { @@ -119,7 +119,7 @@ public void processAdminCentralEventShouldNotStopServicesWhenServicesCommandIsNo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(suspendable); + verifyNoInteractions(suspendable); } @Test @@ -147,7 +147,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenCommandIsNul adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -161,7 +161,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenItIsNotStart adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -174,8 +174,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCommandWasNotD adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -188,8 +188,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenBodyWasNotDefi adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -202,8 +202,8 @@ public void processAdminCentralEventShouldCallSettings() { adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -244,7 +244,7 @@ public void processAdminCentralEventShouldNotCallAmpSettingsCacheWhenCantParseBo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -292,7 +292,7 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCantParseBody( adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); + verifyNoInteractions(settingsCache); } @Test @@ -375,7 +375,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenCommandIs adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -389,7 +389,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenInvalidCo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -403,7 +403,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsCantParseBody adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java index af9af63f06e..9bbc5967cd0 100644 --- a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java @@ -35,7 +35,7 @@ import static org.mockito.BDDMockito.given; 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 AlertHttpServiceTest extends VertxTest { @@ -80,7 +80,7 @@ public void alertShouldNotSendAlertWhenServiceIsNotEnabled() { alertHttpService.alert("pbs", AlertPriority.HIGH, "errorMessage"); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java index 0530fba389b..6620498ccc5 100644 --- a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java +++ b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java @@ -67,7 +67,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 DealsProcessorTest extends VertxTest { @@ -894,7 +894,7 @@ public void populateDealsInfoShouldUseGeoInfoFromContext() { assertThat(result.getBidRequest().getDevice()).isEqualTo(Device.builder() .geo(Geo.builder().ext(expectedExtGeo).build()) .build()); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); assertThat(result.getGeoInfo()).isSameAs(geoInfo); } diff --git a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java index 7cfa3dedaa4..25f7193ea9d 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java @@ -52,7 +52,7 @@ import static org.mockito.BDDMockito.given; 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 DeliveryStatsServiceTest extends VertxTest { @@ -349,7 +349,7 @@ public void suspendShouldSetSuspendFlagAndReportShouldNotBeSent() { deliveryStatsService.sendDeliveryProgressReports(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java index 139bc81234b..4b152236882 100644 --- a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java +++ b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.never; 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 RegisterServiceTest extends VertxTest { @@ -155,7 +155,7 @@ public void registerShouldNotCallAdminCentralWhenResponseIsEmpty() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -185,7 +185,7 @@ public void registerShouldNotCallAdminCentralWhenFutureFailed() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -229,7 +229,7 @@ public void registerShouldNotSendAdminEventWhenResponseStatusIsBadRequest() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test diff --git a/src/test/java/org/prebid/server/deals/UserServiceTest.java b/src/test/java/org/prebid/server/deals/UserServiceTest.java index 9484314d101..9ef73deeae4 100644 --- a/src/test/java/org/prebid/server/deals/UserServiceTest.java +++ b/src/test/java/org/prebid/server/deals/UserServiceTest.java @@ -64,7 +64,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 UserServiceTest extends VertxTest { @@ -131,7 +131,7 @@ public void getUserDetailsShouldReturnEmptyUserDetailsWhenUidsAreEmpty() { // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -157,7 +157,7 @@ public void getUserDetailsShouldReturnReturnEmptyUserDetailsWhenUidsDoesNotConta // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -476,7 +476,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -498,7 +498,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java index 157d4cdc717..b571e897f11 100644 --- a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java +++ b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @SuppressWarnings("ResultOfMethodCallIgnored") @@ -168,8 +168,8 @@ public void syncForFilepathShouldNotTriggerServiceWhenCantCheckIfUsableFileExist // then verify(fileSystem).exists(eq(FILE_PATH), any()); - verifyZeroInteractions(remoteFileProcessor); - verifyZeroInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); } @Test @@ -190,7 +190,7 @@ public void syncForFilepathShouldRetryWhenRemoteFileProcessorIsFailed() { verify(fileSystem, times(2)).exists(eq(FILE_PATH), any()); verify(remoteFileProcessor, times(1)).setDataPath(FILE_PATH); verify(fileSystem).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -350,8 +350,8 @@ public void syncForFilepathShouldRetryAfterFailedDownload() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 1)).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -380,8 +380,8 @@ public void syncForFilepathShouldRetryWhenDeleteFileIsFailed() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 2)).delete(eq(TMP_FILE_PATH), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -461,7 +461,7 @@ public void syncForFilepathShouldRetryWhenTimeoutIsReached() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(TIMEOUT), any()); verify(asyncFile, times(RETRY_COUNT + 1)).close(); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(remoteFileProcessor); } private void givenTriggerUpdate() { diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index 2719dd7a0a9..ad3ccb1172d 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; +import org.mockito.internal.util.reflection.ReflectionMemberAccessor; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -60,7 +60,7 @@ public void setDatabaseReaderShouldReturnFailedFutureIfDatabaseArchiveNotFound() @Test public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuchFieldException, IOException, - GeoIp2Exception { + GeoIp2Exception, IllegalAccessException { // given final Country country = new Country(null, null, null, "fr", null); final Continent continent = new Continent(null, "eu", null, null); @@ -75,8 +75,8 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(cityResponse); - //FieldSetter.setField(maxMindGeoLocationService, - //maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); @@ -96,13 +96,14 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, + IllegalAccessException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java index 99566f9a8f6..85d9fbd39d4 100644 --- a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java @@ -77,7 +77,7 @@ import static org.mockito.Mockito.never; 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 CookieSyncHandlerTest extends VertxTest { @@ -1104,7 +1104,7 @@ public void shouldTolerateMissingTcfParamsInRequestForUsersyncInfo() throws IOEx .extracting(bidderStatus -> bidderStatus.getUsersync().getUrl()) .containsOnly("http://adnxsexample.com/sync?gdpr=&gdpr_consent="); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java index 0720b9e0b2e..3ac0f223ba1 100644 --- a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java @@ -17,7 +17,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 HttpInteractionLogHandlerTest { @@ -89,7 +89,7 @@ public void shouldRespondWithErrorWhenEndpointNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'endpoint' parameter value, allowed values '[auction, amp]'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -106,7 +106,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'statusCode' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -123,7 +123,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'statusCode' must be between 200 and 500")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -138,7 +138,7 @@ public void shouldRespondWithErrorWhenLimitAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'limit'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -154,7 +154,7 @@ public void shouldRespondWithErrorWhenLimitNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'limit' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -170,6 +170,6 @@ public void shouldRespondWithErrorWhenLimitNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'limit' must be between 0 and 5")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } } diff --git a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java index ed89808f92c..a215571e475 100644 --- a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java @@ -18,7 +18,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 LoggerControlKnobHandlerTest { @@ -72,7 +72,7 @@ public void shouldRespondWithErrorWhenLevelAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'level'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -88,7 +88,7 @@ public void shouldRespondWithErrorWhenLevelNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'level' parameter value, allowed values '[warn, debug, error, info]'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -104,7 +104,7 @@ public void shouldRespondWithErrorWhenDurationAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'duration'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -121,7 +121,7 @@ public void shouldRespondWithErrorWhenDurationNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'duration' parameter value")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -138,6 +138,6 @@ public void shouldRespondWithErrorWhenDurationNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'duration' must be between 0 and 10000")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } } diff --git a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java index 88af2a7ab8f..f1253e8099a 100644 --- a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java @@ -44,7 +44,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 NotificationEventHandlerTest extends VertxTest { @@ -100,7 +100,7 @@ public void shouldReturnBadRequestWhenTypeIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -116,7 +116,7 @@ public void shouldReturnBadRequestWhenTypeIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -132,7 +132,7 @@ public void shouldReturnBadRequestWhenBidIdIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -150,7 +150,7 @@ public void shouldReturnBadRequestWhenTimestampIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -167,7 +167,7 @@ public void shouldReturnUnauthorizedWhenAccountIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); } @@ -185,7 +185,7 @@ public void shouldReturnBadRequestWhenFormatValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -204,7 +204,7 @@ public void shouldReturnBadRequestWhenAnalyticsValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -224,7 +224,7 @@ public void shouldReturnBadRequestWhenIntegrationValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -244,7 +244,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountNotFound() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -270,7 +270,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountEventNotEnabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -419,8 +419,8 @@ public void shouldNotProcessLineItemEventWhenDealsDisabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(applicationEventService); - verifyZeroInteractions(userService); + verifyNoInteractions(applicationEventService); + verifyNoInteractions(userService); } @Test @@ -443,7 +443,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAnalyticsValueIsZero() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); } @Test diff --git a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java index deaffcef38d..e8aa1cb8925 100644 --- a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java @@ -23,7 +23,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 SettingsCacheNotificationHandlerTest extends VertxTest { @@ -151,6 +151,6 @@ public void shouldReturnMethodNotAllowedStatusResponseIfRequestHasNeitherPostOrD // then verify(httpResponse).setStatusCode(eq(405)); - verifyZeroInteractions(cacheNotificationListener); + verifyNoInteractions(cacheNotificationListener); } } diff --git a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java index 42deb16a373..42381b41c0c 100644 --- a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java @@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 VtrackHandlerTest extends VertxTest { @@ -95,7 +95,7 @@ public void shouldRespondWithBadRequestWhenAccountParameterIsMissing() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Account 'a' is required query parameter and can't be empty")); @@ -119,7 +119,7 @@ public void shouldRespondWithBadRequestWhenBodyIsEmpty() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Incoming request has no body")); @@ -134,7 +134,7 @@ public void shouldRespondWithBadRequestWhenBodyCannotBeParsed() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Failed to parse request body")); @@ -150,7 +150,7 @@ public void shouldRespondWithBadRequestWhenBidIdIsMissing() throws JsonProcessin handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidid' is required field and can't be empty")); @@ -166,7 +166,7 @@ public void shouldRespondWithBadRequestWhenBidderIsMissing() throws JsonProcessi handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidder' is required field and can't be empty")); @@ -182,7 +182,7 @@ public void shouldRespondWithBadRequestWhenTypeIsNotXML() throws JsonProcessingE handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack only accepts type xml")); @@ -201,7 +201,7 @@ public void shouldRespondWithBadRequestWhenValueDoesNotContainVast() throws Json handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack content must be vast")); @@ -224,7 +224,7 @@ public void shouldRespondWithInternalServerErrorWhenFetchingAccountFails() throw handler.handle(routingContext); // then - verifyZeroInteractions(cacheService); + verifyNoInteractions(cacheService); verify(httpResponse).setStatusCode(eq(500)); verify(httpResponse).end(eq("Error occurred while fetching account: error")); diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java index 6f9c090650b..73aeb891e14 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java @@ -80,7 +80,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AmpHandlerTest extends VertxTest { @@ -192,7 +192,7 @@ public void shouldRespondWithBadRequestIfRequestIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(400)); assertThat(httpResponse.headers()).hasSize(2) @@ -213,7 +213,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedAccount() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -233,7 +233,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedApp() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -253,7 +253,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java index 038f5c723d4..44f2eafb030 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java @@ -69,7 +69,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AuctionHandlerTest extends VertxTest { @@ -233,7 +233,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { auctionHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java index 3eb31e4a11a..a61a47f23c1 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class VideoHandlerTest extends VertxTest { @@ -161,7 +161,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { videoHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Unauthorised: Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index e8374ad8280..4e5fcad3839 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } diff --git a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java index 2d2ba53a759..18ab0b012bf 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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 TcfDefinerServiceTest { @@ -115,8 +115,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabled() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -133,8 +133,8 @@ public void resolveTcfContextShouldReturnContextWithGdprZeroWhenGdprIsDisabledBy // then assertThat(result).succeededWith(TcfContext.builder().build()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -149,8 +149,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabledByAccount() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -168,8 +168,8 @@ public void resolveTcfContextShouldCheckAccountConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -197,8 +197,8 @@ public void resolveTcfContextShouldCheckServiceConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -270,7 +270,7 @@ public void resolveTcfContextShouldConsiderPresenceOfConsentStringAsInScope() { true, null, null, null); assertThat(result.result().getConsent()).isNotNull(); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfRequestsMetric(2); verify(metrics).updatePrivacyTcfGeoMetric(2, null); } @@ -292,7 +292,7 @@ public void resolveTcfContextShouldReturnGdprFromCountryWhenGdprFromRequestIsNot TcfContext::getIpAddress) .containsExactly("1", "consent", null, true, "ip"); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfGeoMetric(2, true); } @@ -394,7 +394,7 @@ public void resolveTcfContextShouldConsultDefaultValueAndSkipGeoLookupWhenIpIsNu TcfContext::getIpAddress) .containsExactly("0", null, null, null, null); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); } @Test @@ -476,7 +476,7 @@ public void resultForVendorIdsShouldAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap(1, PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test @@ -504,7 +504,7 @@ public void resultForBidderNamesShouldReturnAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap("b1", PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java index 3c4d88ebc41..977d486bc07 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java @@ -30,7 +30,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class FullEnforcePurposeStrategyTest { @@ -242,7 +242,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndRequireLI() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -267,7 +267,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowed() { assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -319,7 +319,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndVendorLIAllowe assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // GVL Legitimate interest Purpose part @@ -398,7 +398,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndRequireConsent() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -451,7 +451,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndVendorConsen assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose part @@ -535,7 +535,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowedAndFlexibleAndRequireC // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -562,8 +562,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorLIAllowedAndEnforced // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -643,7 +643,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndFlexibleAndReq // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -670,8 +670,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorConsentAndEnfor // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -753,7 +753,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorLIAllowedAndEnf assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -781,7 +781,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorConsentAllowedAndEnf assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose Legitimate interest part @@ -865,7 +865,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAllowedAndFlexibleAndRequir // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -892,8 +892,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorLIAllowedAndEnforc // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -921,7 +921,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAndEnforced assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -949,7 +949,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAndEnforced assertThat(result).isEmpty(); verify(allowedVendors).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // Restriction type is REQUIRE_LEGITIMATE_INTEREST part @@ -977,7 +977,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndFlexibleAndR // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1004,8 +1004,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorConsentAndEnf // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -1087,7 +1087,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAllowedAndE assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1115,7 +1115,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAllowedAndE assertThat(result).isEmpty(); verify(purposesLI).contains(1); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java index 9b230593859..67b176a63c8 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java @@ -22,7 +22,7 @@ import static org.mockito.ArgumentMatchers.anyInt; 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 SpecialFeaturesOneStrategyTest { @@ -83,7 +83,7 @@ public void processSpecialFeaturesStrategyShouldAllowForAllWhenIsNotEnforced() { assertThat(result).usingFieldByFieldElementComparator().containsOnly(vendorPermission1Changed, vendorPermission2Changed); - verifyZeroInteractions(specialFeatureOptIns); + verifyNoInteractions(specialFeatureOptIns); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java index e21cfadf86a..8426f478d68 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.ONE; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.TWO; @@ -145,7 +145,7 @@ public void shouldStartUsingFallbackVersionIfDeprecatedIsTrue() { final Future> future = vendorListService.forVersion(1); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(future).succeededWith(singletonMap( 52, VendorV2.builder() .id(52) diff --git a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java index 4230a5308cc..2597ecad758 100644 --- a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CompositeApplicationSettingsTest { @@ -75,7 +75,7 @@ public void getAccountByIdShouldReturnAccountFromFirstDelegateIfPresent() { // then assertThat(future.succeeded()).isTrue(); assertThat(future.result()).isSameAs(account); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -138,7 +138,7 @@ public void getStoredDataShouldReturnResultFromFirstDelegateIfPresent() { .containsOnly(entry("key1", "value1")); assertThat(future.result().getStoredIdToImp()).hasSize(1) .containsOnly(entry("key2", "value2")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -261,7 +261,7 @@ public void getAmpStoredDataShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -371,7 +371,7 @@ public void getStoredResponsesShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getIdToStoredResponses()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test diff --git a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java index ca10fd0beb5..2832b916eaf 100644 --- a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class HttpApplicationSettingsTest extends VertxTest { @@ -206,7 +206,7 @@ public void getStoredDataShouldReturnEmptyResultIfEmptyRequestsIdsGiven() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).isEmpty(); assertThat(future.result().getStoredIdToImp()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -221,7 +221,7 @@ public void getStoredDataShouldReturnResultWithErrorIfTimeoutAlreadyExpired() { assertThat(future.result().getStoredIdToImp()).isEmpty(); assertThat(future.result().getErrors()) .containsOnly("Error fetching stored requests for ids [id1] via HTTP: Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test From ad03c04d55f6109f74938440603b6be92c39d7ad Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 19:13:30 +0300 Subject: [PATCH 17/25] Move bytebuddy dependency version to appropriate place --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 01af586dac2..c113aaeae5b 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ 9.4.43.v20210629 3.0.7 1.4.200 + 1.11.19 3.1.0 @@ -403,7 +404,7 @@ net.bytebuddy byte-buddy - 1.11.19 + ${bytebuddy.version} test From 1b9d4ff67ec328e2a9da9368971028a852e15d30 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Fri, 8 Oct 2021 19:38:50 +0300 Subject: [PATCH 18/25] Fix merges after rebase --- .../prebid/server/auction/ExchangeServiceTest.java | 2 +- .../prebid/server/log/HttpInteractionLoggerTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 97afd1c8e62..37d35fb0a49 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -2502,7 +2502,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 diff --git a/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java b/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java index 6be46f2e6a8..4397cedd3e2 100644 --- a/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java +++ b/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java @@ -30,7 +30,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class HttpInteractionLoggerTest extends VertxTest { @@ -103,7 +103,7 @@ public void maybeLogOpenrtb2AuctionShouldNotLogIfAccountIdNotEqualsToGivenInSpec testingInstance.maybeLogOpenrtb2Auction(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -147,7 +147,7 @@ public void maybeLogOpenrtb2AuctionShouldNotLogIfSpecEndpointIsNotAuction() { testingInstance.maybeLogOpenrtb2Auction(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -231,7 +231,7 @@ public void maybeLogOpenrtb2AmpShouldNotLogIfAccountIdNotEqualsToGivenInSpec() { testingInstance.maybeLogOpenrtb2Amp(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -275,7 +275,7 @@ public void maybeLogOpenrtb2AmpShouldNotLogIfSpecEndpointIsNotAmp() { testingInstance.maybeLogOpenrtb2Amp(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -340,7 +340,7 @@ public void maybeLogBidderRequestShouldNotLogIfAccountIdEqualsToGivenInSpecButBi testingInstance.maybeLogBidderRequest(givenAuctionContext, givenBidderRequest); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test From aece6c073665e980a1ebb0edc99d23e54d3ba334 Mon Sep 17 00:00:00 2001 From: rpanchyk Date: Wed, 6 Oct 2021 11:44:12 +0300 Subject: [PATCH 19/25] Update test dependencies --- pom.xml | 21 +++++--- .../PubstackAnalyticsReporterTest.java | 15 +++--- .../pubstack/PubstackEventHandlerTest.java | 4 +- .../server/auction/ExchangeServiceTest.java | 28 +++++------ .../PrivacyEnforcementServiceTest.java | 4 +- .../auction/StoredRequestProcessorTest.java | 8 ++-- .../auction/StoredResponseProcessorTest.java | 6 +-- .../requestfactory/AmpRequestFactoryTest.java | 6 +-- .../Ortb2ImplicitParametersResolverTest.java | 4 +- .../Ortb2RequestFactoryTest.java | 14 +++--- .../bidder/BidderErrorNotifierTest.java | 4 +- .../bidder/HttpBidderRequesterTest.java | 8 ++-- .../bidder/appnexus/AppnexusBidderTest.java | 4 +- .../bidder/rubicon/RubiconBidderTest.java | 4 +- .../prebid/server/cache/CacheServiceTest.java | 6 +-- .../server/cookie/UidsCookieServiceTest.java | 4 +- .../server/deals/AdminCentralServiceTest.java | 30 ++++++------ .../server/deals/AlertHttpServiceTest.java | 4 +- .../server/deals/DealsProcessorTest.java | 4 +- .../deals/DeliveryProgressServiceTest.java | 2 +- .../deals/DeliveryStatsServiceTest.java | 4 +- .../server/deals/RegisterServiceTest.java | 8 ++-- .../prebid/server/deals/UserServiceTest.java | 10 ++-- .../execution/RemoteFileSyncerTest.java | 18 +++---- .../MaxMindGeoLocationServiceTest.java | 15 +++--- .../server/handler/CookieSyncHandlerTest.java | 4 +- .../HttpInteractionLogHandlerTest.java | 14 +++--- .../handler/LoggerControlKnobHandlerTest.java | 12 ++--- .../handler/NotificationEventHandlerTest.java | 28 +++++------ .../SettingsCacheNotificationHandlerTest.java | 4 +- .../server/handler/VtrackHandlerTest.java | 18 +++---- .../handler/openrtb2/AmpHandlerTest.java | 10 ++-- .../handler/openrtb2/AuctionHandlerTest.java | 4 +- .../handler/openrtb2/VideoHandlerTest.java | 4 +- .../hooks/execution/HookCatalogTest.java | 14 +++--- .../org/prebid/server/log/CriteriaTest.java | 6 +-- .../server/log/HttpInteractionLoggerTest.java | 12 ++--- .../privacy/gdpr/TcfDefinerServiceTest.java | 32 ++++++------- .../FullEnforcePurposeStrategyTest.java | 48 +++++++++---------- .../SpecialFeaturesOneStrategyTest.java | 4 +- .../vendorlist/VendorListServiceV2Test.java | 4 +- .../CompositeApplicationSettingsTest.java | 10 ++-- .../settings/HttpApplicationSettingsTest.java | 6 +-- .../bidder/util/UsersyncerCreatorTest.java | 4 +- 44 files changed, 241 insertions(+), 232 deletions(-) diff --git a/pom.xml b/pom.xml index a2b9873c30b..684da3dbe34 100644 --- a/pom.xml +++ b/pom.xml @@ -47,14 +47,15 @@ 2.12.0 - 4.13.1 - 2.23.4 - 3.8.0 - 2.26.3 - 4.0.1 + 4.13.2 + 3.12.4 + 3.21.0 + 2.27.2 + 4.1.0 9.4.43.v20210629 - 3.0.6 - 1.4.196 + 3.3.0 + 1.4.200 + 1.11.13 3.1.0 @@ -400,6 +401,12 @@ ${restassured.version} test + + net.bytebuddy + byte-buddy + ${bytebuddy.version} + test + io.vertx diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java index ae43831e80b..8709a688d80 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackAnalyticsReporterTest.java @@ -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 { @@ -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()); } @@ -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 @@ -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 diff --git a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java index 2ae7e4c0d7a..bf244a529a4 100644 --- a/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java +++ b/src/test/java/org/prebid/server/analytics/pubstack/PubstackEventHandlerTest.java @@ -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 { @@ -88,7 +88,7 @@ public void handleShouldNotAcceptEventsWhenNotEnabled() { (AtomicReference>) ReflectionTestUtils .getField(pubstackEventHandler, "events"); assertThat(events.get()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 6c41cf013e5..2da03d5abf6 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -182,8 +182,8 @@ 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; @@ -351,8 +351,8 @@ public void shouldTolerateImpWithoutExtension() { final BidResponse bidResponse = exchangeService.holdAuction(givenRequestContext(bidRequest)).result(); // then - verifyZeroInteractions(bidderCatalog); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(bidderCatalog); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -368,7 +368,7 @@ public void shouldTolerateImpWithUnknownBidderInExtension() { // then verify(bidderCatalog).isValidName(eq("invalid")); - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); assertThat(bidResponse).isNotNull(); } @@ -507,7 +507,7 @@ public void shouldSkipBidderWhenRejectedByBidderRequestHooks() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -667,7 +667,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 bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); @@ -677,7 +677,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"))); } @@ -796,7 +796,7 @@ public void shouldNotCreateRequestForBidderRestrictedByPrivacyEnforcement() { exchangeService.holdAuction(givenRequestContext(bidRequest)); // then - verifyZeroInteractions(httpBidderRequester); + verifyNoInteractions(httpBidderRequester); } @Test @@ -1787,7 +1787,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")); } @@ -1807,7 +1807,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)); } @@ -2481,10 +2481,10 @@ public void shouldRemoveSiteIfBothSiteAndAppPresent() { final BidRequest captureBidRequest = captureBidRequest(); assertThat(captureBidRequest) .extracting(BidRequest::getSite) - .containsNull(); + .isNull(); assertThat(captureBidRequest) .extracting(BidRequest::getApp) - .doesNotContainNull(); + .isNotNull(); } @Test @@ -2502,7 +2502,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 @@ -3253,7 +3253,7 @@ public void shouldReturnEmptyBidResponseWhenRequestIsRejected() { final Future result = exchangeService.holdAuction(auctionContext); // then - verifyZeroInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); + verifyNoInteractions(storedResponseProcessor, httpBidderRequester, hookStageExecutor, bidResponseCreator); assertThat(result).succeededWith(BidResponse.builder() .seatbid(emptyList()) .build()); diff --git a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java index 918de53824c..9bec2a50064 100644 --- a/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java +++ b/src/test/java/org/prebid/server/auction/PrivacyEnforcementServiceTest.java @@ -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 { @@ -407,7 +407,7 @@ public void shouldMaskForCoppaWhenDeviceLmtIsEnforceAndOneAndRegsCoppaIsOneAndDo .build(); assertThat(result).isEqualTo(singletonList(expected)); - verifyZeroInteractions(tcfDefinerService); + verifyNoInteractions(tcfDefinerService); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java index 31034b72e0b..45bcc1e17af 100644 --- a/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredRequestProcessorTest.java @@ -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 { @@ -543,7 +543,7 @@ public void shouldReturnImpAndBidRequestWithoutChangesIfStoredRequestIsAbsentInP final Future 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); @@ -737,7 +737,7 @@ public void processStoredRequestsShouldNotUpdateMetricsIfApplicationSettingsFail ExtRequestPrebid.builder().storedrequest(ExtStoredRequest.of("bidRequest")).build())))); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test @@ -750,7 +750,7 @@ public void processAmpRequestShouldNotUpdateMetricsIfApplicationSettingsFailed() storedRequestProcessor.processAmpRequest(null, "123", BidRequest.builder().build()); // then - verifyZeroInteractions(metrics); + verifyNoInteractions(metrics); } @Test diff --git a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java index eb8db31babe..844ebb7a32b 100644 --- a/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java +++ b/src/test/java/org/prebid/server/auction/StoredResponseProcessorTest.java @@ -47,7 +47,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 { @@ -110,7 +110,7 @@ public void getStoredResponseResultShouldNotChangeImpsAndReturnSeatBidsWhenThere singletonList(imp), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test @@ -132,7 +132,7 @@ public void getStoredResponseResultShouldAddImpToRequiredRequestWhenItsStoredAuc .build()), emptyList(), emptyMap())); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java index 508d4708d3f..c41a6b8543a 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/AmpRequestFactoryTest.java @@ -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 { @@ -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()) @@ -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())); } diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java index 061fd22e721..ea2f8b6000e 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2ImplicitParametersResolverTest.java @@ -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 @@ -1628,7 +1628,7 @@ public void shouldSetDefaultIncludeBidderKeysToFalseIfIncludeBidderKeysIsMissedA // then assertThat(result.getExt()) .extracting(extBidRequest -> extBidRequest.getPrebid().getTargeting().getIncludebidderkeys()) - .containsOnly(false); + .isEqualTo(false); } @Test diff --git a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java index b99bca34fbc..1219fa7ddb8 100644 --- a/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java +++ b/src/test/java/org/prebid/server/auction/requestfactory/Ortb2RequestFactoryTest.java @@ -84,7 +84,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; 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 Ortb2RequestFactoryTest extends VertxTest { @@ -482,7 +482,7 @@ public void fetchAccountShouldReturnEmptyAccountIfItIsMissingInRequest() { .build()); // then - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.result()).isEqualTo(Account.empty("")); } @@ -540,7 +540,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureWhenAccountIdIsBlac // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()) @@ -579,7 +579,7 @@ public void shouldFetchAccountFromStoredAndReturnFailedFutureIfValidIsEnforcedAn // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -601,7 +601,7 @@ public void shouldFetchAccountFromStoredAndReturnEmptyAccountIfStoredLookupIsFai // then verify(storedRequestProcessor).processStoredRequests("", receivedBidRequest); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); assertThat(result.failed()).isTrue(); assertThat(result.cause()).hasMessage("error"); @@ -617,7 +617,7 @@ public void fetchAccountWithoutStoredRequestLookupShouldNeverCallStoredProcessor .build()); // then - verifyZeroInteractions(storedRequestProcessor); + verifyNoInteractions(storedRequestProcessor); } @Test @@ -809,7 +809,7 @@ public void enrichBidRequestWithAccountAndPrivacyDataShouldReturnIntegrationFrom // then assertThat(result) .extracting(auctionBidRequest -> auctionBidRequest.getExt().getPrebid().getIntegration()) - .containsOnly(integration); + .isEqualTo(integration); } @Test diff --git a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java index d71f2b608b4..99e5ef58be6 100644 --- a/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java +++ b/src/test/java/org/prebid/server/bidder/BidderErrorNotifierTest.java @@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 BidderErrorNotifierTest { @@ -60,7 +60,7 @@ public void shouldNotSendTimeoutNotificationWhenBidderDoesNotCreateRequest() { // then verify(bidder).makeTimeoutNotification(eq(bidderRequest)); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 3570a9f6b6f..3608b1041fa 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -63,7 +63,7 @@ import static org.mockito.Mockito.never; 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.when; public class HttpBidderRequesterTest extends VertxTest { @@ -170,12 +170,12 @@ public void shouldPassStoredResponseToBidderMakeBidsMethodAndReturnSeatBids() { .result(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); final ArgumentCaptor> httpCallArgumentCaptor = ArgumentCaptor.forClass(HttpCall.class); verify(bidder).makeBids(httpCallArgumentCaptor.capture(), any()); assertThat(httpCallArgumentCaptor.getValue().getResponse()) .extracting(HttpResponse::getBody) - .containsOnly("storedResponse"); + .isEqualTo("storedResponse"); assertThat(bidderSeatBid.getBids()).containsOnlyElementsOf(bids); } @@ -612,7 +612,7 @@ public void shouldTolerateAlreadyExpiredGlobalTimeout() { assertThat(bidderSeatBid.getErrors()).hasSize(1) .extracting(BidderError::getMessage) .containsOnly("Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java index 53217e24c59..3d0171932b2 100644 --- a/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/appnexus/AppnexusBidderTest.java @@ -478,8 +478,8 @@ public void makeHttpRequestsShouldSetImpTagidAndImpBidFloorIfExtImpAppnexusHasIn // then assertThat(result.getValue()).hasSize(1) .extracting(res -> mapper.readValue(res.getBody(), BidRequest.class)) - .element(0).extracting(BidRequest::getImp).hasSize(1) - .containsOnly(singletonList(Imp.builder() + .element(0).extracting(BidRequest::getImp) + .isEqualTo(singletonList(Imp.builder() .bidfloor(BigDecimal.valueOf(10)) .tagid("tagid") .ext(mapper.valueToTree( diff --git a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java index d1b8612e481..60009349dbb 100644 --- a/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/rubicon/RubiconBidderTest.java @@ -113,7 +113,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; import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; import static org.prebid.server.proto.openrtb.ext.response.BidType.video; @@ -537,7 +537,7 @@ public void makeHttpRequestsShouldNotSetBidFloorCurrencyToUSDIfNull() { final Result>> result = rubiconBidder.makeHttpRequests(bidRequest); // then - verifyZeroInteractions(currencyConversionService); + verifyNoInteractions(currencyConversionService); assertThat(result.getErrors()).hasSize(1) .containsOnly(BidderError.of("Imp `impId` floor provided with no currency, assuming USD", BidderError.Type.bad_input)); diff --git a/src/test/java/org/prebid/server/cache/CacheServiceTest.java b/src/test/java/org/prebid/server/cache/CacheServiceTest.java index 7af0cdcb3a7..b050c9e002a 100644 --- a/src/test/java/org/prebid/server/cache/CacheServiceTest.java +++ b/src/test/java/org/prebid/server/cache/CacheServiceTest.java @@ -71,7 +71,7 @@ import static org.mockito.Mockito.eq; 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 CacheServiceTest extends VertxTest { @@ -176,7 +176,7 @@ public void cacheBidsOpenrtbShouldNeverCallCacheServiceIfNoBidsPassed() { cacheService.cacheBidsOpenrtb(emptyList(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -762,7 +762,7 @@ public void cachePutObjectsShouldReturnResultWithEmptyListWhenPutObjectsIsEmpty( emptySet(), null, null, null); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(result.result().getResponses()).isEmpty(); } diff --git a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java index 8a8ab3d418a..a66ed086899 100644 --- a/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java +++ b/src/test/java/org/prebid/server/cookie/UidsCookieServiceTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.within; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class UidsCookieServiceTest extends VertxTest { @@ -382,7 +382,7 @@ public void shouldNotReadHostCookieIfNameNotSpecified() { final String hostCookie = uidsCookieService.parseHostCookie(emptyMap()); // then - verifyZeroInteractions(routingContext); + verifyNoInteractions(routingContext); assertThat(hostCookie).isNull(); } diff --git a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java index 22fa213ec11..6be2ee7e4ee 100644 --- a/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AdminCentralServiceTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.eq; 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 AdminCentralServiceTest extends VertxTest { @@ -119,7 +119,7 @@ public void processAdminCentralEventShouldNotStopServicesWhenServicesCommandIsNo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(suspendable); + verifyNoInteractions(suspendable); } @Test @@ -147,7 +147,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenCommandIsNul adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -161,7 +161,7 @@ public void processAdminCentralEventShouldNotCallCriteriaManagerWhenItIsNotStart adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(criteriaManager); + verifyNoInteractions(criteriaManager); } @Test @@ -174,8 +174,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCommandWasNotD adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -188,8 +188,8 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenBodyWasNotDefi adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -202,8 +202,8 @@ public void processAdminCentralEventShouldCallSettings() { adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(settingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -244,7 +244,7 @@ public void processAdminCentralEventShouldNotCallAmpSettingsCacheWhenCantParseBo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(ampSettingsCache); + verifyNoInteractions(ampSettingsCache); } @Test @@ -292,7 +292,7 @@ public void processAdminCentralEventShouldNotCallSettingsCacheWhenCantParseBody( adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(settingsCache); + verifyNoInteractions(settingsCache); } @Test @@ -375,7 +375,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenCommandIs adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -389,7 +389,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsWhenInvalidCo adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test @@ -403,7 +403,7 @@ public void processAdminCentralEventShouldNotCallInvalidateAccountsCantParseBody adminCentralService.processAdminCentralEvent(adminCentralResponse); // then - verifyZeroInteractions(cachingApplicationSettings); + verifyNoInteractions(cachingApplicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java index af9af63f06e..9bbc5967cd0 100644 --- a/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java +++ b/src/test/java/org/prebid/server/deals/AlertHttpServiceTest.java @@ -35,7 +35,7 @@ import static org.mockito.BDDMockito.given; 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 AlertHttpServiceTest extends VertxTest { @@ -80,7 +80,7 @@ public void alertShouldNotSendAlertWhenServiceIsNotEnabled() { alertHttpService.alert("pbs", AlertPriority.HIGH, "errorMessage"); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java index 0530fba389b..6620498ccc5 100644 --- a/src/test/java/org/prebid/server/deals/DealsProcessorTest.java +++ b/src/test/java/org/prebid/server/deals/DealsProcessorTest.java @@ -67,7 +67,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 DealsProcessorTest extends VertxTest { @@ -894,7 +894,7 @@ public void populateDealsInfoShouldUseGeoInfoFromContext() { assertThat(result.getBidRequest().getDevice()).isEqualTo(Device.builder() .geo(Geo.builder().ext(expectedExtGeo).build()) .build()); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); assertThat(result.getGeoInfo()).isSameAs(geoInfo); } diff --git a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java index c4ca10d531e..92850f9f65c 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryProgressServiceTest.java @@ -221,7 +221,7 @@ public void processAuctionEventShouldUpdateCurrentPlan() { .extracting(lineItemId1) .extracting(lineItemId2) .extracting(lostToLineItem -> ((LostToLineItem) lostToLineItem).getCount().sum()) - .containsOnly(1L); + .isEqualTo(1L); assertThat(lineItemStatuses) .flatExtracting(LineItemStatus::getDeliveryPlans) diff --git a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java index 7cfa3dedaa4..25f7193ea9d 100644 --- a/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java +++ b/src/test/java/org/prebid/server/deals/DeliveryStatsServiceTest.java @@ -52,7 +52,7 @@ import static org.mockito.BDDMockito.given; 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 DeliveryStatsServiceTest extends VertxTest { @@ -349,7 +349,7 @@ public void suspendShouldSetSuspendFlagAndReportShouldNotBeSent() { deliveryStatsService.sendDeliveryProgressReports(); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java index 139bc81234b..4b152236882 100644 --- a/src/test/java/org/prebid/server/deals/RegisterServiceTest.java +++ b/src/test/java/org/prebid/server/deals/RegisterServiceTest.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.never; 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 RegisterServiceTest extends VertxTest { @@ -155,7 +155,7 @@ public void registerShouldNotCallAdminCentralWhenResponseIsEmpty() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -185,7 +185,7 @@ public void registerShouldNotCallAdminCentralWhenFutureFailed() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test @@ -229,7 +229,7 @@ public void registerShouldNotSendAdminEventWhenResponseStatusIsBadRequest() { registerService.register(MultiMap.caseInsensitiveMultiMap()); // then - verifyZeroInteractions(adminEventService); + verifyNoInteractions(adminEventService); } @Test diff --git a/src/test/java/org/prebid/server/deals/UserServiceTest.java b/src/test/java/org/prebid/server/deals/UserServiceTest.java index 9484314d101..9ef73deeae4 100644 --- a/src/test/java/org/prebid/server/deals/UserServiceTest.java +++ b/src/test/java/org/prebid/server/deals/UserServiceTest.java @@ -64,7 +64,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 UserServiceTest extends VertxTest { @@ -131,7 +131,7 @@ public void getUserDetailsShouldReturnEmptyUserDetailsWhenUidsAreEmpty() { // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -157,7 +157,7 @@ public void getUserDetailsShouldReturnReturnEmptyUserDetailsWhenUidsDoesNotConta // then verify(metrics).updateUserDetailsRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertEquals(UserDetails.empty(), result); } @@ -476,7 +476,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -498,7 +498,7 @@ public void processWinEventShouldCallMetricsPreparationFailedMetricWhenHttpClien // then verify(metrics).updateWinRequestPreparationFailed(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java index 157d4cdc717..b571e897f11 100644 --- a/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java +++ b/src/test/java/org/prebid/server/execution/RemoteFileSyncerTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @SuppressWarnings("ResultOfMethodCallIgnored") @@ -168,8 +168,8 @@ public void syncForFilepathShouldNotTriggerServiceWhenCantCheckIfUsableFileExist // then verify(fileSystem).exists(eq(FILE_PATH), any()); - verifyZeroInteractions(remoteFileProcessor); - verifyZeroInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); } @Test @@ -190,7 +190,7 @@ public void syncForFilepathShouldRetryWhenRemoteFileProcessorIsFailed() { verify(fileSystem, times(2)).exists(eq(FILE_PATH), any()); verify(remoteFileProcessor, times(1)).setDataPath(FILE_PATH); verify(fileSystem).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -350,8 +350,8 @@ public void syncForFilepathShouldRetryAfterFailedDownload() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 1)).open(eq(TMP_FILE_PATH), any(), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -380,8 +380,8 @@ public void syncForFilepathShouldRetryWhenDeleteFileIsFailed() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(RETRY_INTERVAL), any()); verify(fileSystem, times(RETRY_COUNT + 2)).delete(eq(TMP_FILE_PATH), any()); - verifyZeroInteractions(httpClient); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(httpClient); + verifyNoInteractions(remoteFileProcessor); } @Test @@ -461,7 +461,7 @@ public void syncForFilepathShouldRetryWhenTimeoutIsReached() { verify(vertx, times(RETRY_COUNT + 1)).setTimer(eq(TIMEOUT), any()); verify(asyncFile, times(RETRY_COUNT + 1)).close(); - verifyZeroInteractions(remoteFileProcessor); + verifyNoInteractions(remoteFileProcessor); } private void givenTriggerUpdate() { diff --git a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java index b6c8fdc596b..ad3ccb1172d 100644 --- a/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java +++ b/src/test/java/org/prebid/server/geolocation/MaxMindGeoLocationServiceTest.java @@ -12,7 +12,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; +import org.mockito.internal.util.reflection.ReflectionMemberAccessor; import org.prebid.server.geolocation.model.GeoInfo; import java.io.IOException; @@ -60,7 +60,7 @@ public void setDatabaseReaderShouldReturnFailedFutureIfDatabaseArchiveNotFound() @Test public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuchFieldException, IOException, - GeoIp2Exception { + GeoIp2Exception, IllegalAccessException { // given final Country country = new Country(null, null, null, "fr", null); final Continent continent = new Continent(null, "eu", null, null); @@ -75,8 +75,8 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(cityResponse); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); @@ -96,13 +96,14 @@ public void lookupShouldReturnCountryIsoWhenDatabaseReaderWasSet() throws NoSuch } @Test - public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException { + public void lookupShouldTolerateMissingGeoInfo() throws IOException, GeoIp2Exception, NoSuchFieldException, + IllegalAccessException { // given final DatabaseReader databaseReader = Mockito.mock(DatabaseReader.class); given(databaseReader.city(any())).willReturn(null); - FieldSetter.setField(maxMindGeoLocationService, - maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), databaseReader); + new ReflectionMemberAccessor().set(maxMindGeoLocationService.getClass().getDeclaredField("databaseReader"), + maxMindGeoLocationService, databaseReader); // when final Future future = maxMindGeoLocationService.lookup(TEST_IP, null); diff --git a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java index 99566f9a8f6..85d9fbd39d4 100644 --- a/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/CookieSyncHandlerTest.java @@ -77,7 +77,7 @@ import static org.mockito.Mockito.never; 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 CookieSyncHandlerTest extends VertxTest { @@ -1104,7 +1104,7 @@ public void shouldTolerateMissingTcfParamsInRequestForUsersyncInfo() throws IOEx .extracting(bidderStatus -> bidderStatus.getUsersync().getUrl()) .containsOnly("http://adnxsexample.com/sync?gdpr=&gdpr_consent="); - verifyZeroInteractions(applicationSettings); + verifyNoInteractions(applicationSettings); } @Test diff --git a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java index 0720b9e0b2e..3ac0f223ba1 100644 --- a/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/HttpInteractionLogHandlerTest.java @@ -17,7 +17,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 HttpInteractionLogHandlerTest { @@ -89,7 +89,7 @@ public void shouldRespondWithErrorWhenEndpointNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'endpoint' parameter value, allowed values '[auction, amp]'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -106,7 +106,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'statusCode' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -123,7 +123,7 @@ public void shouldRespondWithErrorWhenStatusCodeNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'statusCode' must be between 200 and 500")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -138,7 +138,7 @@ public void shouldRespondWithErrorWhenLimitAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'limit'")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -154,7 +154,7 @@ public void shouldRespondWithErrorWhenLimitNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'limit' parameter value")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } @Test @@ -170,6 +170,6 @@ public void shouldRespondWithErrorWhenLimitNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'limit' must be between 0 and 5")); - verifyZeroInteractions(httpInteractionLogger); + verifyNoInteractions(httpInteractionLogger); } } diff --git a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java index ed89808f92c..a215571e475 100644 --- a/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/LoggerControlKnobHandlerTest.java @@ -18,7 +18,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 LoggerControlKnobHandlerTest { @@ -72,7 +72,7 @@ public void shouldRespondWithErrorWhenLevelAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'level'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -88,7 +88,7 @@ public void shouldRespondWithErrorWhenLevelNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'level' parameter value, allowed values '[warn, debug, error, info]'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -104,7 +104,7 @@ public void shouldRespondWithErrorWhenDurationAbsent() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Missing required parameter 'duration'")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -121,7 +121,7 @@ public void shouldRespondWithErrorWhenDurationNotInteger() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Invalid 'duration' parameter value")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } @Test @@ -138,6 +138,6 @@ public void shouldRespondWithErrorWhenDurationNotValid() { verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Parameter 'duration' must be between 0 and 10000")); - verifyZeroInteractions(loggerControlKnob); + verifyNoInteractions(loggerControlKnob); } } diff --git a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java index 88af2a7ab8f..f1253e8099a 100644 --- a/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/NotificationEventHandlerTest.java @@ -44,7 +44,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 NotificationEventHandlerTest extends VertxTest { @@ -100,7 +100,7 @@ public void shouldReturnBadRequestWhenTypeIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -116,7 +116,7 @@ public void shouldReturnBadRequestWhenTypeIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -132,7 +132,7 @@ public void shouldReturnBadRequestWhenBidIdIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -150,7 +150,7 @@ public void shouldReturnBadRequestWhenTimestampIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -167,7 +167,7 @@ public void shouldReturnUnauthorizedWhenAccountIsMissing() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); } @@ -185,7 +185,7 @@ public void shouldReturnBadRequestWhenFormatValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -204,7 +204,7 @@ public void shouldReturnBadRequestWhenAnalyticsValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -224,7 +224,7 @@ public void shouldReturnBadRequestWhenIntegrationValueIsInvalid() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(400); } @@ -244,7 +244,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountNotFound() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -270,7 +270,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAccountEventNotEnabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); assertThat(captureResponseStatusCode()).isEqualTo(401); assertThat(captureResponseBody()).isEqualTo("Account 'accountId' doesn't support events"); @@ -419,8 +419,8 @@ public void shouldNotProcessLineItemEventWhenDealsDisabled() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(applicationEventService); - verifyZeroInteractions(userService); + verifyNoInteractions(applicationEventService); + verifyNoInteractions(userService); } @Test @@ -443,7 +443,7 @@ public void shouldNotPassEventToAnalyticsReporterWhenAnalyticsValueIsZero() { notificationHandler.handle(routingContext); // then - verifyZeroInteractions(analyticsReporterDelegator); + verifyNoInteractions(analyticsReporterDelegator); } @Test diff --git a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java index deaffcef38d..e8aa1cb8925 100644 --- a/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/SettingsCacheNotificationHandlerTest.java @@ -23,7 +23,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 SettingsCacheNotificationHandlerTest extends VertxTest { @@ -151,6 +151,6 @@ public void shouldReturnMethodNotAllowedStatusResponseIfRequestHasNeitherPostOrD // then verify(httpResponse).setStatusCode(eq(405)); - verifyZeroInteractions(cacheNotificationListener); + verifyNoInteractions(cacheNotificationListener); } } diff --git a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java index 42deb16a373..42381b41c0c 100644 --- a/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/VtrackHandlerTest.java @@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.isNull; 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 VtrackHandlerTest extends VertxTest { @@ -95,7 +95,7 @@ public void shouldRespondWithBadRequestWhenAccountParameterIsMissing() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Account 'a' is required query parameter and can't be empty")); @@ -119,7 +119,7 @@ public void shouldRespondWithBadRequestWhenBodyIsEmpty() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Incoming request has no body")); @@ -134,7 +134,7 @@ public void shouldRespondWithBadRequestWhenBodyCannotBeParsed() { handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("Failed to parse request body")); @@ -150,7 +150,7 @@ public void shouldRespondWithBadRequestWhenBidIdIsMissing() throws JsonProcessin handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidid' is required field and can't be empty")); @@ -166,7 +166,7 @@ public void shouldRespondWithBadRequestWhenBidderIsMissing() throws JsonProcessi handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("'bidder' is required field and can't be empty")); @@ -182,7 +182,7 @@ public void shouldRespondWithBadRequestWhenTypeIsNotXML() throws JsonProcessingE handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack only accepts type xml")); @@ -201,7 +201,7 @@ public void shouldRespondWithBadRequestWhenValueDoesNotContainVast() throws Json handler.handle(routingContext); // then - verifyZeroInteractions(applicationSettings, cacheService); + verifyNoInteractions(applicationSettings, cacheService); verify(httpResponse).setStatusCode(eq(400)); verify(httpResponse).end(eq("vtrack content must be vast")); @@ -224,7 +224,7 @@ public void shouldRespondWithInternalServerErrorWhenFetchingAccountFails() throw handler.handle(routingContext); // then - verifyZeroInteractions(cacheService); + verifyNoInteractions(cacheService); verify(httpResponse).setStatusCode(eq(500)); verify(httpResponse).end(eq("Error occurred while fetching account: error")); diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java index 6f9c090650b..73aeb891e14 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AmpHandlerTest.java @@ -80,7 +80,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AmpHandlerTest extends VertxTest { @@ -192,7 +192,7 @@ public void shouldRespondWithBadRequestIfRequestIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(400)); assertThat(httpResponse.headers()).hasSize(2) @@ -213,7 +213,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedAccount() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -233,7 +233,7 @@ public void shouldRespondWithBadRequestIfRequestHasBlacklistedApp() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(403)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) @@ -253,7 +253,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { ampHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); assertThat(httpResponse.headers()).hasSize(2) .extracting(Map.Entry::getKey, Map.Entry::getValue) diff --git a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java index 038f5c723d4..44f2eafb030 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/AuctionHandlerTest.java @@ -69,7 +69,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class AuctionHandlerTest extends VertxTest { @@ -233,7 +233,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { auctionHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java index 3eb31e4a11a..a61a47f23c1 100644 --- a/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java +++ b/src/test/java/org/prebid/server/handler/openrtb2/VideoHandlerTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class VideoHandlerTest extends VertxTest { @@ -161,7 +161,7 @@ public void shouldRespondWithUnauthorizedIfAccountIdIsInvalid() { videoHandler.handle(routingContext); // then - verifyZeroInteractions(exchangeService); + verifyNoInteractions(exchangeService); verify(httpResponse).setStatusCode(eq(401)); verify(httpResponse).end(eq("Unauthorised: Account id is not provided")); } diff --git a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java index fca5e0f4543..bea98aa2df8 100644 --- a/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java +++ b/src/test/java/org/prebid/server/hooks/execution/HookCatalogTest.java @@ -75,7 +75,7 @@ public void hookByIdShouldReturnEntrypointHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -90,7 +90,7 @@ public void hookByIdShouldReturnRawAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -105,7 +105,7 @@ public void hookByIdShouldReturnProcessedAuctionRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -120,7 +120,7 @@ public void hookByIdShouldReturnBidderRequestHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -135,7 +135,7 @@ public void hookByIdShouldReturnRawBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -150,7 +150,7 @@ public void hookByIdShouldReturnProcessedBidderResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } @Test @@ -165,7 +165,7 @@ public void hookByIdShouldReturnAuctionResponseHook() { // then assertThat(foundHook).isNotNull() .extracting(Hook::code) - .containsOnly("sample-hook"); + .isEqualTo("sample-hook"); } private void givenHook(Class> clazz) { diff --git a/src/test/java/org/prebid/server/log/CriteriaTest.java b/src/test/java/org/prebid/server/log/CriteriaTest.java index e8374ad8280..4e5fcad3839 100644 --- a/src/test/java/org/prebid/server/log/CriteriaTest.java +++ b/src/test/java/org/prebid/server/log/CriteriaTest.java @@ -10,7 +10,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CriteriaTest { @@ -92,7 +92,7 @@ public void logResponseShouldNotLogResponseWhenOneOfNutNullCriteriaMissing() { criteria.logResponse("Response has account", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -116,6 +116,6 @@ public void logResponseAndRequestShouldNotLogResponseWhenOneOfNutNullCriteriaMis criteria.logResponseAndRequest("Response has account", "Request", logger); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } } diff --git a/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java b/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java index 6be46f2e6a8..4397cedd3e2 100644 --- a/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java +++ b/src/test/java/org/prebid/server/log/HttpInteractionLoggerTest.java @@ -30,7 +30,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class HttpInteractionLoggerTest extends VertxTest { @@ -103,7 +103,7 @@ public void maybeLogOpenrtb2AuctionShouldNotLogIfAccountIdNotEqualsToGivenInSpec testingInstance.maybeLogOpenrtb2Auction(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -147,7 +147,7 @@ public void maybeLogOpenrtb2AuctionShouldNotLogIfSpecEndpointIsNotAuction() { testingInstance.maybeLogOpenrtb2Auction(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -231,7 +231,7 @@ public void maybeLogOpenrtb2AmpShouldNotLogIfAccountIdNotEqualsToGivenInSpec() { testingInstance.maybeLogOpenrtb2Amp(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -275,7 +275,7 @@ public void maybeLogOpenrtb2AmpShouldNotLogIfSpecEndpointIsNotAmp() { testingInstance.maybeLogOpenrtb2Amp(givenAuctionContext, routingContext, 200, null); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test @@ -340,7 +340,7 @@ public void maybeLogBidderRequestShouldNotLogIfAccountIdEqualsToGivenInSpecButBi testingInstance.maybeLogBidderRequest(givenAuctionContext, givenBidderRequest); // then - verifyZeroInteractions(logger); + verifyNoInteractions(logger); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java index 2d2ba53a759..18ab0b012bf 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/TcfDefinerServiceTest.java @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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 TcfDefinerServiceTest { @@ -115,8 +115,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabled() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -133,8 +133,8 @@ public void resolveTcfContextShouldReturnContextWithGdprZeroWhenGdprIsDisabledBy // then assertThat(result).succeededWith(TcfContext.builder().build()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -149,8 +149,8 @@ public void resolveTcfContextShouldReturnContextWhenGdprIsDisabledByAccount() { // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -168,8 +168,8 @@ public void resolveTcfContextShouldCheckAccountConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -197,8 +197,8 @@ public void resolveTcfContextShouldCheckServiceConfigValueWhenRequestTypeIsUnkno // then assertThat(result).succeededWith(TcfContext.empty()); - verifyZeroInteractions(geoLocationService); - verifyZeroInteractions(metrics); + verifyNoInteractions(geoLocationService); + verifyNoInteractions(metrics); } @Test @@ -270,7 +270,7 @@ public void resolveTcfContextShouldConsiderPresenceOfConsentStringAsInScope() { true, null, null, null); assertThat(result.result().getConsent()).isNotNull(); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfRequestsMetric(2); verify(metrics).updatePrivacyTcfGeoMetric(2, null); } @@ -292,7 +292,7 @@ public void resolveTcfContextShouldReturnGdprFromCountryWhenGdprFromRequestIsNot TcfContext::getIpAddress) .containsExactly("1", "consent", null, true, "ip"); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); verify(metrics).updatePrivacyTcfGeoMetric(2, true); } @@ -394,7 +394,7 @@ public void resolveTcfContextShouldConsultDefaultValueAndSkipGeoLookupWhenIpIsNu TcfContext::getIpAddress) .containsExactly("0", null, null, null, null); - verifyZeroInteractions(geoLocationService); + verifyNoInteractions(geoLocationService); } @Test @@ -476,7 +476,7 @@ public void resultForVendorIdsShouldAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap(1, PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test @@ -504,7 +504,7 @@ public void resultForBidderNamesShouldReturnAllowAllWhenGdprIsZero() { assertThat(result).succeededWith( TcfResponse.of(false, singletonMap("b1", PrivacyEnforcementAction.allowAll()), null)); - verifyZeroInteractions(tcf2Service); + verifyNoInteractions(tcf2Service); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java index 3c4d88ebc41..977d486bc07 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/purpose/typestrategies/FullEnforcePurposeStrategyTest.java @@ -30,7 +30,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class FullEnforcePurposeStrategyTest { @@ -242,7 +242,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndRequireLI() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -267,7 +267,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowed() { assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -319,7 +319,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndVendorLIAllowe assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // GVL Legitimate interest Purpose part @@ -398,7 +398,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndRequireConsent() { // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -451,7 +451,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndVendorConsen assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose part @@ -535,7 +535,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAllowedAndFlexibleAndRequireC // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -562,8 +562,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorLIAllowedAndEnforced // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -643,7 +643,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAllowedAndFlexibleAndReq // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -670,8 +670,8 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorConsentAndEnfor // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -753,7 +753,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeConsentAndVendorLIAllowedAndEnf assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -781,7 +781,7 @@ public void shouldEmptyWhenInGvlPurposeAndPurposeLIAndVendorConsentAllowedAndEnf assertThat(result).isEmpty(); verify(purposesLI).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } // Flexible GVL Purpose Legitimate interest part @@ -865,7 +865,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAllowedAndFlexibleAndRequir // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } @Test @@ -892,8 +892,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorLIAllowedAndEnforc // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesLI); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(purposesLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -921,7 +921,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAndEnforced assertThat(result).isEmpty(); verify(purposesConsent).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(allowedVendorsLI); + verifyNoInteractions(allowedVendorsLI); } @Test @@ -949,7 +949,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAndEnforced assertThat(result).isEmpty(); verify(allowedVendors).contains(PURPOSE_CODE.code()); - verifyZeroInteractions(purposesLI); + verifyNoInteractions(purposesLI); } // Restriction type is REQUIRE_LEGITIMATE_INTEREST part @@ -977,7 +977,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAllowedAndFlexibleAndR // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1004,8 +1004,8 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorConsentAndEnf // then assertThat(result).isEmpty(); - verifyZeroInteractions(purposesConsent); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(purposesConsent); + verifyNoInteractions(allowedVendors); } @Test @@ -1087,7 +1087,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeConsentAndVendorLIAllowedAndE assertThat(result).isEmpty(); verify(allowedVendorsLI).contains(1); - verifyZeroInteractions(purposesConsent); + verifyNoInteractions(purposesConsent); } @Test @@ -1115,7 +1115,7 @@ public void shouldEmptyWhenInGvlPurposeLIAndPurposeLIAndVendorConsentAllowedAndE assertThat(result).isEmpty(); verify(purposesLI).contains(1); - verifyZeroInteractions(allowedVendors); + verifyNoInteractions(allowedVendors); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java index 9b230593859..67b176a63c8 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/tcfstrategies/specialfeature/SpecialFeaturesOneStrategyTest.java @@ -22,7 +22,7 @@ import static org.mockito.ArgumentMatchers.anyInt; 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 SpecialFeaturesOneStrategyTest { @@ -83,7 +83,7 @@ public void processSpecialFeaturesStrategyShouldAllowForAllWhenIsNotEnforced() { assertThat(result).usingFieldByFieldElementComparator().containsOnly(vendorPermission1Changed, vendorPermission2Changed); - verifyZeroInteractions(specialFeatureOptIns); + verifyNoInteractions(specialFeatureOptIns); } @Test diff --git a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java index e21cfadf86a..8426f478d68 100644 --- a/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java +++ b/src/test/java/org/prebid/server/privacy/gdpr/vendorlist/VendorListServiceV2Test.java @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; 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; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.ONE; import static org.prebid.server.privacy.gdpr.vendorlist.proto.PurposeCode.TWO; @@ -145,7 +145,7 @@ public void shouldStartUsingFallbackVersionIfDeprecatedIsTrue() { final Future> future = vendorListService.forVersion(1); // then - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); assertThat(future).succeededWith(singletonMap( 52, VendorV2.builder() .id(52) diff --git a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java index 4230a5308cc..2597ecad758 100644 --- a/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/CompositeApplicationSettingsTest.java @@ -32,7 +32,7 @@ import static org.mockito.ArgumentMatchers.anyString; 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 CompositeApplicationSettingsTest { @@ -75,7 +75,7 @@ public void getAccountByIdShouldReturnAccountFromFirstDelegateIfPresent() { // then assertThat(future.succeeded()).isTrue(); assertThat(future.result()).isSameAs(account); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -138,7 +138,7 @@ public void getStoredDataShouldReturnResultFromFirstDelegateIfPresent() { .containsOnly(entry("key1", "value1")); assertThat(future.result().getStoredIdToImp()).hasSize(1) .containsOnly(entry("key2", "value2")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -261,7 +261,7 @@ public void getAmpStoredDataShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test @@ -371,7 +371,7 @@ public void getStoredResponsesShouldReturnResultFromFirstDelegateIfPresent() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getIdToStoredResponses()).hasSize(1) .containsOnly(entry("key1", "value1")); - verifyZeroInteractions(delegate2); + verifyNoInteractions(delegate2); } @Test diff --git a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java index ca10fd0beb5..2832b916eaf 100644 --- a/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java +++ b/src/test/java/org/prebid/server/settings/HttpApplicationSettingsTest.java @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; public class HttpApplicationSettingsTest extends VertxTest { @@ -206,7 +206,7 @@ public void getStoredDataShouldReturnEmptyResultIfEmptyRequestsIdsGiven() { assertThat(future.result().getErrors()).isEmpty(); assertThat(future.result().getStoredIdToRequest()).isEmpty(); assertThat(future.result().getStoredIdToImp()).isEmpty(); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -221,7 +221,7 @@ public void getStoredDataShouldReturnResultWithErrorIfTimeoutAlreadyExpired() { assertThat(future.result().getStoredIdToImp()).isEmpty(); assertThat(future.result().getErrors()) .containsOnly("Error fetching stored requests for ids [id1] via HTTP: Timeout has been exceeded"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test diff --git a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java index 95d6aee6d55..4a8da9abcab 100644 --- a/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java +++ b/src/test/java/org/prebid/server/spring/config/bidder/util/UsersyncerCreatorTest.java @@ -24,7 +24,7 @@ public void createShouldReturnUsersyncerWithConcatenatedExternalAndRedirectUrl() // when and then assertThat(UsersyncerCreator.create("http://localhost:8000").apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly("http://localhost:8000/redirect-url"); + .isEqualTo("http://localhost:8000/redirect-url"); } @Test @@ -39,7 +39,7 @@ public void createShouldReturnUsersyncerWithEmptyRedirectUrlWhenItWasNotDefined( // when and then assertThat(UsersyncerCreator.create(null).apply(config)) .extracting(usersyncer -> usersyncer.getPrimaryMethod().getRedirectUrl()) - .containsOnly(""); + .isEqualTo(""); } @Test From c04e7ab75992f82a83566f1c47ad0ea9ad055398 Mon Sep 17 00:00:00 2001 From: ozhevedenko Date: Mon, 11 Oct 2021 16:41:47 +0300 Subject: [PATCH 20/25] Bump Mockito --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 684da3dbe34..3b96947bcb5 100644 --- a/pom.xml +++ b/pom.xml @@ -48,14 +48,14 @@ 4.13.2 - 3.12.4 + 4.0.0 3.21.0 2.27.2 4.1.0 9.4.43.v20210629 3.3.0 1.4.200 - 1.11.13 + 1.11.19 3.1.0 From 9da09e3af3ea658d07434fa3397befb5f0d2980c Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Mon, 25 Oct 2021 13:49:38 +0300 Subject: [PATCH 21/25] Fix my merge --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 463c9eeeb1c..8060412b03b 100644 --- a/pom.xml +++ b/pom.xml @@ -53,8 +53,6 @@ 2.27.2 4.1.0 9.4.43.v20210629 - 3.0.6 - 1.4.196 1.3-groovy-2.5 1.15.3 5.11.2 From e6c4e9cbd899e3b4b9f2632b74b2f45038b29d03 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Mon, 25 Oct 2021 15:05:22 +0300 Subject: [PATCH 22/25] Change .containsOnly to .containsExactlyInAnyOrder for Iterable types in tests --- .../java/org/prebid/server/auction/ExchangeServiceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 2da03d5abf6..9dc7fd91acc 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -668,7 +668,7 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final JsonNode bidders1 = prebid1.getBidders(); assertThat(bidders1).isNotNull(); assertThat(bidders1.fields()).toIterable().hasSize(1) - .containsOnly(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); + .containsExactlyInAnyOrder(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); final ArgumentCaptor bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); verify(httpBidderRequester).requestBids(same(bidder2), bidRequest2Captor.capture(), any(), any(), anyBoolean()); @@ -678,7 +678,7 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final JsonNode bidders2 = prebid2.getBidders(); assertThat(bidders2).isNotNull(); assertThat(bidders2.fields()).toIterable().hasSize(1) - .containsOnly(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); + .containsExactlyInAnyOrder(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); } @Test From 862b1e89c0312a52d04be5ae5feba3e41983cc22 Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Mon, 25 Oct 2021 15:56:58 +0300 Subject: [PATCH 23/25] Remove unnecessary .hasSize() --- .../org/prebid/server/auction/ExchangeServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 9dc7fd91acc..8b505689df8 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -667,8 +667,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { assertThat(prebid1).isNotNull(); final JsonNode bidders1 = prebid1.getBidders(); assertThat(bidders1).isNotNull(); - assertThat(bidders1.fields()).toIterable().hasSize(1) - .containsExactlyInAnyOrder(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); + assertThat(bidders1.fields()).toIterable() + .containsOnly(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); final ArgumentCaptor bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); verify(httpBidderRequester).requestBids(same(bidder2), bidRequest2Captor.capture(), any(), any(), anyBoolean()); @@ -677,8 +677,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { assertThat(prebid2).isNotNull(); final JsonNode bidders2 = prebid2.getBidders(); assertThat(bidders2).isNotNull(); - assertThat(bidders2.fields()).toIterable().hasSize(1) - .containsExactlyInAnyOrder(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); + assertThat(bidders2.fields()).toIterable() + .containsOnly(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); } @Test From 8641766d5df3087e4bdc0d06ecf17bce58a5c62c Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Mon, 25 Oct 2021 17:41:14 +0300 Subject: [PATCH 24/25] Refactor 2 assertions in one in ExchangeServiceTest --- .../org/prebid/server/auction/ExchangeServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 8b505689df8..3351744cc3b 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -666,8 +666,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final ExtRequestPrebid prebid1 = capturedBidRequest1.getBidRequest().getExt().getPrebid(); assertThat(prebid1).isNotNull(); final JsonNode bidders1 = prebid1.getBidders(); - assertThat(bidders1).isNotNull(); - assertThat(bidders1.fields()).toIterable() + assertThat(bidders1).isNotNull() + .extracting(JsonNode::fields).asList() .containsOnly(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); final ArgumentCaptor bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); @@ -676,8 +676,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final ExtRequestPrebid prebid2 = capturedBidRequest2.getExt().getPrebid(); assertThat(prebid2).isNotNull(); final JsonNode bidders2 = prebid2.getBidders(); - assertThat(bidders2).isNotNull(); - assertThat(bidders2.fields()).toIterable() + assertThat(bidders2).isNotNull() + .extracting(JsonNode::fields).asList() .containsOnly(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); } From e774db3a91cb4989c5a568427a41c22d4c6663bf Mon Sep 17 00:00:00 2001 From: Yevhenii Viktorov Date: Tue, 26 Oct 2021 18:33:15 +0300 Subject: [PATCH 25/25] Revert test --- .../org/prebid/server/auction/ExchangeServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java index 3351744cc3b..2da03d5abf6 100644 --- a/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java +++ b/src/test/java/org/prebid/server/auction/ExchangeServiceTest.java @@ -666,8 +666,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final ExtRequestPrebid prebid1 = capturedBidRequest1.getBidRequest().getExt().getPrebid(); assertThat(prebid1).isNotNull(); final JsonNode bidders1 = prebid1.getBidders(); - assertThat(bidders1).isNotNull() - .extracting(JsonNode::fields).asList() + assertThat(bidders1).isNotNull(); + assertThat(bidders1.fields()).toIterable().hasSize(1) .containsOnly(entry("bidder", mapper.createObjectNode().put("test1", "test1"))); final ArgumentCaptor bidRequest2Captor = ArgumentCaptor.forClass(BidderRequest.class); @@ -676,8 +676,8 @@ public void shouldPassRequestWithExtPrebidToDefinedBidder() { final ExtRequestPrebid prebid2 = capturedBidRequest2.getExt().getPrebid(); assertThat(prebid2).isNotNull(); final JsonNode bidders2 = prebid2.getBidders(); - assertThat(bidders2).isNotNull() - .extracting(JsonNode::fields).asList() + assertThat(bidders2).isNotNull(); + assertThat(bidders2.fields()).toIterable().hasSize(1) .containsOnly(entry("bidder", mapper.createObjectNode().put("test2", "test2"))); }