Merge branch 'AlicanAkkus-master'

This commit is contained in:
Marcin Grzejszczak
2019-08-30 15:12:06 +02:00

View File

@@ -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();