Skip to content

Commit 08d4a20

Browse files
author
Ronald Holshausen
committedNov 3, 2019
fix: Upgraded JUnit to 5.5.2; fixed JUnit4 tests that were not running #967
1 parent 2ef11f5 commit 08d4a20

File tree

53 files changed

+187
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+187
-149
lines changed
 

Diff for: ‎consumer/pact-jvm-consumer-specs2/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ dependencies {
1212
testCompile "org.specs2:specs2-junit_2.12:${project.specs2Version}",
1313
"ch.qos.logback:logback-core:${project.logbackVersion}",
1414
"ch.qos.logback:logback-classic:${project.logbackVersion}"
15+
testRuntime "org.junit.vintage:junit-vintage-engine:${project.junit5Version}"
1516
}
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
package au.com.dius.pact.consumer.specs2
22

3+
import au.com.dius.pact.consumer.PactVerificationResult
34
import au.com.dius.pact.core.matchers.BodyMismatch
45
import au.com.dius.pact.core.matchers.HeaderMismatch
5-
import au.com.dius.pact.core.matchers.PartialRequestMatch
6+
import au.com.dius.pact.core.matchers.Mismatch
67
import au.com.dius.pact.core.matchers.PathMismatch
78
import au.com.dius.pact.core.model.OptionalBody
8-
import au.com.dius.pact.core.model.ProviderState
99
import au.com.dius.pact.core.model.Request
10-
import au.com.dius.pact.core.model.RequestResponseInteraction
1110
import au.com.dius.pact.core.model.Response
11+
import scala.collection.JavaConverters
1212
import spock.lang.Specification
1313

1414
class PrettyPrinterSpec extends Specification {
1515

1616
def headers = [testreqheader: 'testreqheadervalue', 'Content-Type': 'application/json']
17-
def request = new Request('POST', '/', null, headers, OptionalBody.body('{"test": true}'.bytes))
17+
def request = new Request('POST', '/', [:], headers, OptionalBody.body('{"test": true}'.bytes))
1818
def response = new Response(200, [testreqheader: 'testreqheaderval', 'Access-Control-Allow-Origin': '*'],
1919
OptionalBody.body('{"responsetest": true}'.bytes))
2020

21-
def print(mismatch) {
22-
PrettyPrinter.print(PactSessionResults.empty().addAlmostMatched(
23-
new PartialRequestMatch([(new RequestResponseInteraction('test interaction', [
24-
new ProviderState('test state')], request, response)): [mismatch]])))
21+
def printMismatch(Mismatch mismatch) {
22+
PrettyPrinter.print(JavaConverters.asScalaBuffer(
23+
[new PactVerificationResult.PartialMismatch([mismatch])]).toSeq())
2524
}
2625

2726
def plus = '+++ '
2827

2928
def 'header mismatch'() {
3029
expect:
31-
print(new HeaderMismatch('foo', 'bar', '', null)) ==
30+
printMismatch(new HeaderMismatch('foo', 'bar', '', '')) ==
3231
"""--- Header foo
3332
|$plus
3433
|@@ -1,1 +1,1 @@
@@ -38,7 +37,7 @@ class PrettyPrinterSpec extends Specification {
3837

3938
def 'path mismatch'() {
4039
expect:
41-
print(new PathMismatch('/foo/bar', '/foo/baz')) ==
40+
printMismatch(new PathMismatch('/foo/bar', '/foo/baz')) ==
4241
"""--- Path
4342
|$plus
4443
|@@ -1,1 +1,1 @@
@@ -48,13 +47,13 @@ class PrettyPrinterSpec extends Specification {
4847

4948
def 'body mismatch'() {
5049
expect:
51-
print(new BodyMismatch('{"foo": "bar"}', '{"ork": "Bif"}')) ==
50+
printMismatch(new BodyMismatch('{"foo": "bar"}', '{"ork": "Bif"}', '')) ==
5251
"""--- Body
5352
|$plus
5453
|@@ -1,3 +1,3 @@
5554
| {
56-
|- "foo": "bar"
57-
|+ "ork": "Bif"
55+
|- "foo": "bar"
56+
|+ "ork": "Bif"
5857
| }""".stripMargin()
5958
}
6059
}

0 commit comments

Comments
 (0)
Please sign in to comment.