Skip to content

Commit 2d20163

Browse files
committed
fix: Dependency conflict with org.slf4j:slf4j-api was causing Spring tests to fail
1 parent 38c0d27 commit 2d20163

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

buildSrc/src/main/groovy/au.com.dius.pact.kotlin-common-conventions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies {
4141
implementation 'org.apache.commons:commons-collections4:4.4'
4242
implementation 'org.apache.tika:tika-core:2.9.1'
4343
implementation 'com.google.guava:guava:31.1-jre'
44-
implementation 'org.slf4j:slf4j-api:1.7.36'
44+
implementation 'org.slf4j:slf4j-api:2.0.4'
4545
implementation 'io.ktor:ktor-http-jvm:2.3.8'
4646
implementation 'io.ktor:ktor-server-netty:2.3.8'
4747
implementation 'io.ktor:ktor-network-tls-certificates:2.3.8'

provider/junit5spring/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ dependencies {
1717
implementation 'org.apache.commons:commons-lang3'
1818
implementation 'javax.mail:mail:1.5.0-b01'
1919

20-
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.14'
21-
testImplementation 'org.springframework.boot:spring-boot-starter-web:2.5.14'
20+
testImplementation 'org.springframework.boot:spring-boot-test:2.5.14'
21+
testImplementation 'org.springframework.boot:spring-boot-test-autoconfigure:2.5.14'
22+
testImplementation 'org.springframework:spring-webmvc:5.3.20'
2223
testImplementation 'org.apache.groovy:groovy'
24+
testImplementation 'org.yaml:snakeyaml:1.33'
2325
}

provider/junit5spring/src/test/java/au/com/dius/pact/provider/spring/junit5/MockMvcTestTargetWebMvcTestJava.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import au.com.dius.pact.provider.junitsupport.Provider;
66
import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
77
import org.junit.jupiter.api.BeforeEach;
8-
import org.junit.jupiter.api.Disabled;
98
import org.junit.jupiter.api.TestTemplate;
109
import org.junit.jupiter.api.extension.ExtendWith;
1110
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +23,6 @@
2423
@WebMvcTest
2524
@Provider("myAwesomeService")
2625
@PactFolder("pacts")
27-
@Disabled // TODO: this fails with NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
2826
class MockMvcTestTargetWebMvcTestJava {
2927

3028
@Autowired

provider/junit5spring/src/test/java/au/com/dius/pact/provider/spring/junit5/WebTestClientPactTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import au.com.dius.pact.provider.junitsupport.Provider;
55
import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
66
import org.junit.jupiter.api.BeforeEach;
7-
import org.junit.jupiter.api.Disabled;
87
import org.junit.jupiter.api.TestTemplate;
98
import org.junit.jupiter.api.extension.ExtendWith;
109
import org.springframework.boot.test.context.SpringBootTest;
@@ -18,7 +17,6 @@
1817
@SpringBootTest
1918
@Provider("myAwesomeService")
2019
@PactFolder("pacts")
21-
@Disabled // TODO: this fails with NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
2220
class WebTestClientPactTest {
2321

2422
public static class Handler {

provider/spring/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public class PactVerificationTest {
198198
```
199199

200200
#### JUnit5
201-
You actually don't need to dependend on `pact-jvm-provider-spring` for this. It's sufficient to depend on `pact-jvm-provider-junit5`.
201+
You actually don't need to depend on `pact-jvm-provider-spring` for this. It's sufficient to depend on `pact-jvm-provider-junit5`.
202202

203203
You can set the port to the `HttpTestTarget` object in the before method.
204204

0 commit comments

Comments
 (0)