From d079d452ae06944163875a7a0d481a7559a6ae9d Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Fri, 23 Dec 2022 13:41:17 +1100 Subject: [PATCH] chore: correct build on JDK 16+ --- .../consumer/groovy/PactBodyBuilderSpec.groovy | 12 ++++++------ .../consumer/PactDslJsonArrayMatcherSpec.groovy | 12 ++++++------ .../consumer/PactDslJsonContentMatcherSpec.groovy | 6 +++--- .../au/com/dius/pact/core/model/V3PactSpec.groovy | 4 ++-- .../groovy/broker/PactBrokerClientPactSpec.groovy | 6 +++--- .../com/dius/pact/provider/ProviderInfoSpec.groovy | 12 ++++++------ .../pact/provider/VerificationResultSpec.groovy | 6 +++--- .../provider/reporters/JsonReporterSpec.groovy | 14 +++++++------- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilderSpec.groovy b/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilderSpec.groovy index 0d61fc1e2c..a23032df8f 100644 --- a/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilderSpec.groovy +++ b/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilderSpec.groovy @@ -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 } } @@ -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'() { diff --git a/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonArrayMatcherSpec.groovy b/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonArrayMatcherSpec.groovy index c09865fee4..36ffda24d0 100644 --- a/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonArrayMatcherSpec.groovy +++ b/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonArrayMatcherSpec.groovy @@ -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 } } @@ -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 } } @@ -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 } } @@ -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 } } @@ -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 } } @@ -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 } } diff --git a/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonContentMatcherSpec.groovy b/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonContentMatcherSpec.groovy index 85b47be824..dc40ef786a 100644 --- a/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonContentMatcherSpec.groovy +++ b/consumer/src/test/groovy/au/com/dius/pact/consumer/PactDslJsonContentMatcherSpec.groovy @@ -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 } } @@ -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 } } @@ -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 } } diff --git a/core/model/src/test/groovy/au/com/dius/pact/core/model/V3PactSpec.groovy b/core/model/src/test/groovy/au/com/dius/pact/core/model/V3PactSpec.groovy index 3ee074a186..daf4625cc0 100644 --- a/core/model/src/test/groovy/au/com/dius/pact/core/model/V3PactSpec.groovy +++ b/core/model/src/test/groovy/au/com/dius/pact/core/model/V3PactSpec.groovy @@ -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() } @@ -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' ]] diff --git a/pact-publish/src/test/groovy/broker/PactBrokerClientPactSpec.groovy b/pact-publish/src/test/groovy/broker/PactBrokerClientPactSpec.groovy index 1ea6d4cc15..17f99180e9 100644 --- a/pact-publish/src/test/groovy/broker/PactBrokerClientPactSpec.groovy +++ b/pact-publish/src/test/groovy/broker/PactBrokerClientPactSpec.groovy @@ -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 } @@ -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 } @@ -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 } diff --git a/provider/src/test/groovy/au/com/dius/pact/provider/ProviderInfoSpec.groovy b/provider/src/test/groovy/au/com/dius/pact/provider/ProviderInfoSpec.groovy index 53ff56502c..3223fc3433 100644 --- a/provider/src/test/groovy/au/com/dius/pact/provider/ProviderInfoSpec.groovy +++ b/provider/src/test/groovy/au/com/dius/pact/provider/ProviderInfoSpec.groovy @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/provider/src/test/groovy/au/com/dius/pact/provider/VerificationResultSpec.groovy b/provider/src/test/groovy/au/com/dius/pact/provider/VerificationResultSpec.groovy index ef84eef283..5f309c1477 100644 --- a/provider/src/test/groovy/au/com/dius/pact/provider/VerificationResultSpec.groovy +++ b/provider/src/test/groovy/au/com/dius/pact/provider/VerificationResultSpec.groovy @@ -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' @@ -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' @@ -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' diff --git a/provider/src/test/groovy/au/com/dius/pact/provider/reporters/JsonReporterSpec.groovy b/provider/src/test/groovy/au/com/dius/pact/provider/reporters/JsonReporterSpec.groovy index f686c30b65..184a867477 100644 --- a/provider/src/test/groovy/au/com/dius/pact/provider/reporters/JsonReporterSpec.groovy +++ b/provider/src/test/groovy/au/com/dius/pact/provider/reporters/JsonReporterSpec.groovy @@ -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']] } @@ -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' } @@ -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"]] @@ -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' } }