diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/StubRunnerWireMockTestExecutionListener.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/StubRunnerWireMockTestExecutionListener.java index 712a8e6300..8515234e32 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/StubRunnerWireMockTestExecutionListener.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/StubRunnerWireMockTestExecutionListener.java @@ -18,7 +18,6 @@ package org.springframework.cloud.contract.stubrunner.provider.wiremock; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.TestContext; @@ -38,23 +37,20 @@ public final class StubRunnerWireMockTestExecutionListener @Override public void afterTestClass(TestContext testContext) { - if (testContext.getTestClass() - .getAnnotationsByType(AutoConfigureStubRunner.class).length == 0) { + if (testContext.getTestClass().getAnnotationsByType(AutoConfigureStubRunner.class).length == 0) { if (log.isDebugEnabled()) { - log.debug("No @AutoConfigureStubRunner annotation found on [" - + testContext.getTestClass() + "]. Skipping"); + log.debug("No @AutoConfigureStubRunner annotation found on [" + testContext.getTestClass() + "]. Skipping"); } return; } - if (WireMockHttpServerStub.SERVERS.values().stream().anyMatch(p -> !p.random)) { + if (WireMockHttpServerStub.SERVERS.values().stream().noneMatch(p -> p.random)) { if (log.isWarnEnabled()) { log.warn("You've used fixed ports for WireMock setup - " + "will mark context as dirty. Please use random ports, as much " - + "as possible. Your tests will be faster and more reliable and this" + + "as possible. Your tests will be faster and more reliable and this " + "warning will go away"); } - testContext - .markApplicationContextDirty(DirtiesContext.HierarchyMode.EXHAUSTIVE); + testContext.markApplicationContextDirty(DirtiesContext.HierarchyMode.EXHAUSTIVE); } // potential race condition WireMockHttpServerStub.SERVERS.clear();