Skip to content

Commit

Permalink
chore: correct build on JDK 16+
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Dec 23, 2022
1 parent a127525 commit d079d45
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ class PactBodyBuilderSpec extends Specification {
'$.orders[*].lineItems[*].productCodes': new MatchingRuleGroup([TypeMatcher.INSTANCE]),
'$.orders[*].lineItems[*].productCodes[*].code': new MatchingRuleGroup([TypeMatcher.INSTANCE])
]
body.orders.size == 2
body.orders.size() == 2
body.orders.every { it.keySet() == ['id', 'lineItems'] as Set }
body.orders.first().lineItems.size == 3
body.orders.first().lineItems.size() == 3
body.orders.first().lineItems.every { it.keySet() == ['id', 'amount', 'productCodes'] as Set }
body.orders.first().lineItems.first().productCodes.size == 4
body.orders.first().lineItems.first().productCodes.size() == 4
body.orders.first().lineItems.first().productCodes.every { it.keySet() == ['code'] as Set }
}

Expand Down Expand Up @@ -292,9 +292,9 @@ class PactBodyBuilderSpec extends Specification {
'$.permissions3': new MatchingRuleGroup([new MaxTypeMatcher(4)]),
'$.permissions3[*]': new MatchingRuleGroup([new RegexMatcher('\\d+')])
]
body.permissions.size == 3
body.permissions2.size == 3
body.permissions3.size == 3
body.permissions.size() == 3
body.permissions2.size() == 3
body.permissions3.size() == 3
}

def 'pretty prints bodies by default'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.size == 3
result.size() == 3
result.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -139,7 +139,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.size == 3
result.size() == 3
result.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -154,7 +154,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.size == 3
result.size() == 3
result.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -171,7 +171,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.first().size == 2
result.first().size() == 2
result.first().every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -188,7 +188,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.first().size == 2
result.first().size() == 2
result.first().every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -205,7 +205,7 @@ class PactDslJsonArrayMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.first().size == 2
result.first().size() == 2
result.first().every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class PactDslJsonContentMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.data.size == 2
result.data.size() == 2
result.data.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -77,7 +77,7 @@ class PactDslJsonContentMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.data.size == 2
result.data.size() == 2
result.data.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand All @@ -94,7 +94,7 @@ class PactDslJsonContentMatcherSpec extends Specification {
def result = new JsonSlurper().parseText(subject.body.toString())

then:
result.data.size == 2
result.data.size() == 2
result.data.every { it.keySet() == ['defDate', 'cost'] as Set }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class V3PactSpec extends Specification {
def json = pactFile.withReader { Json.INSTANCE.toMap(JsonParser.INSTANCE.parseReader(it)) }

then:
json.messages.size == 2
json.messages.size() == 2
json.messages*.description.toSet() == ['a hello message', 'a new hello message'].toSet()
}

Expand Down Expand Up @@ -76,7 +76,7 @@ class V3PactSpec extends Specification {
def json = pactFile.withReader { Json.INSTANCE.toMap(JsonParser.INSTANCE.parseReader(it)) }

then:
json.messages.size == 3
json.messages.size() == 3
json.messages*.description.toSet() == ['a hello message', 'a new hello message'].toSet()
json.messages.find { it.description == 'a hello message' && !it.providerStates } ==
[contents: 'Hello', description: 'a hello message', metaData: [ contentType: 'application/json' ]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ class PactBrokerClientPactSpec extends Specification {
new ConsumerVersionSelector('test', true, null, null)
], [], '', false, '')
assert consumerPacts instanceof Ok
assert consumerPacts.value.size == 2
assert consumerPacts.value.size() == 2
assert !consumerPacts.value[0].pending
assert !consumerPacts.value[1].pending
}
Expand Down Expand Up @@ -1033,7 +1033,7 @@ class PactBrokerClientPactSpec extends Specification {
new ConsumerVersionSelector('test', true, null, null)
], ['tag'], 'master', true, '')
assert consumerPacts instanceof Ok
assert consumerPacts.value.size == 2
assert consumerPacts.value.size() == 2
assert !consumerPacts.value[0].pending
assert consumerPacts.value[1].pending
}
Expand Down Expand Up @@ -1158,7 +1158,7 @@ class PactBrokerClientPactSpec extends Specification {
new ConsumerVersionSelector('test', true, null, null)
], ['tag'], 'master', true, '2020-06-24')
assert consumerPacts instanceof Ok
assert consumerPacts.value.size == 2
assert consumerPacts.value.size() == 2
assert !consumerPacts.value[0].wip
assert consumerPacts.value[1].wip
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, [], '', false, '') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], false, null, false, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
!result[0].pending
}
Expand All @@ -103,7 +103,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, ['master'], '', true, '') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], true, null, false, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
result[0].pending
}
Expand All @@ -126,7 +126,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, [], 'master', true, '') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], true, null, false, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
result[0].pending
}
Expand Down Expand Up @@ -168,7 +168,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, ['master'], '', true, '') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], false, null, false, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
!result[0].pending
}
Expand All @@ -192,7 +192,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, ['master'], '', true, '2020-05-23') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], true, null, true, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
result[0].pending
}
Expand All @@ -214,7 +214,7 @@ class ProviderInfoSpec extends Specification {
pactBrokerClient.fetchConsumersWithSelectorsV2('TestProvider', selectors, [], '', false, '') >> new Ok([
new PactBrokerResult('consumer', '', url, [], [], true, null, true, false, null)
])
result.size == 1
result.size() == 1
result[0].name == 'consumer'
result[0].pending
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class VerificationResultSpec extends Specification {

then:
result instanceof TestResult.Failed
result.results.size == 1
result.results.size() == 1
result.results[0].interactionId == '1234ABCD'
result.results[0].exception.message == 'Boom'
result.results[0].description == 'Request to provider method failed with an exception'
Expand All @@ -71,7 +71,7 @@ class VerificationResultSpec extends Specification {

then:
result instanceof TestResult.Failed
result.results.size == 1
result.results.size() == 1
result.results[0].interactionId == '1234ABCD'
result.results[0].exception instanceof RuntimeException
result.results[0].exception.message == 'Boom'
Expand Down Expand Up @@ -107,7 +107,7 @@ class VerificationResultSpec extends Specification {

then:
result instanceof TestResult.Failed
result.results.size == 3
result.results.size() == 3
result.results[0].interactionId == '1234ABCD'
result.results[0].attribute == 'status'
result.results[0].description == 'expected status of 200 but was 404'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class JsonReporterSpec extends Specification {
then:
reportDir.list().sort() as List == ['provider1.json']
reportJson.provider.name == 'provider1'
reportJson.execution.size == 2
reportJson.execution.size() == 2
reportJson.execution*.interactions*.interaction.description == [['Interaction 1'], ['Interaction 2']]
}

Expand Down Expand Up @@ -106,7 +106,7 @@ class JsonReporterSpec extends Specification {
then:
reportDir.list().sort() as List == ['provider1.json']
reportJson.provider.name == 'provider1'
reportJson.execution.size == 1
reportJson.execution.size() == 1
reportJson.execution.first().interactions.first().interaction.description == 'Interaction 1'
}

Expand Down Expand Up @@ -177,8 +177,8 @@ class JsonReporterSpec extends Specification {

then:
reportJson.provider.name == 'provider1'
reportJson.execution.size == 1
reportJson.execution[0].interactions.size == 1
reportJson.execution.size() == 1
reportJson.execution[0].interactions.size() == 1
reportJson.execution[0].interactions[0].verification.result == 'failed'
reportJson.execution[0].interactions[0].verification.status == ['expected status of 201 but was 200']
reportJson.execution[0].interactions[0].verification.header == ['HEADER-X': ["Expected a header 'HEADER-X' but was missing"]]
Expand All @@ -205,11 +205,11 @@ class JsonReporterSpec extends Specification {
def reportJson = new JsonSlurper().parse(new File(reportDir, 'provider1.json'))

then:
reportJson.execution.size == 1
reportJson.execution[0].interactions.size == 1
reportJson.execution.size() == 1
reportJson.execution[0].interactions.size() == 1
reportJson.execution[0].interactions[0].verification.result == 'failed'
reportJson.execution[0].interactions[0].verification.exception.message == 'xxxx'
reportJson.execution[0].interactions[0].verification.exception.stackTrace.size > 1
reportJson.execution[0].interactions[0].verification.exception.stackTrace.size() > 1
reportJson.execution[0].interactions[0].verification.exception.stackTrace[0] == 'java.lang.Exception: xxxx'
}
}

0 comments on commit d079d45

Please sign in to comment.