From 0afd421f0710554977633d17fb02eedc4e39dfda Mon Sep 17 00:00:00 2001 From: anto Date: Wed, 17 Jun 2020 17:57:40 +0100 Subject: [PATCH] fix: add missing test case for JsonParser --- .../core/support/json/JsonParserSpec.groovy | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/core/support/src/test/groovy/au/com/dius/pact/core/support/json/JsonParserSpec.groovy b/core/support/src/test/groovy/au/com/dius/pact/core/support/json/JsonParserSpec.groovy index 5c3a44b1ac..fe68850c48 100644 --- a/core/support/src/test/groovy/au/com/dius/pact/core/support/json/JsonParserSpec.groovy +++ b/core/support/src/test/groovy/au/com/dius/pact/core/support/json/JsonParserSpec.groovy @@ -46,20 +46,22 @@ class JsonParserSpec extends Specification { where: - description | json | result - 'integer' | ' 1234' | new JsonValue.Integer('1234'.chars) - 'decimal' | ' 1234.56 ' | new JsonValue.Decimal('1234.56'.chars) - 'true' | 'true' | JsonValue.True.INSTANCE - 'false' | 'false' | JsonValue.False.INSTANCE - 'null' | 'null' | JsonValue.Null.INSTANCE - 'string' | '"null"' | new JsonValue.StringValue('null'.chars) - 'array' | '[1, 200, 3, "4"]' | new JsonValue.Array([new JsonValue.Integer('1'.chars), new JsonValue.Integer('200'.chars), new JsonValue.Integer('3'.chars), new JsonValue.StringValue('4'.chars)]) - '2d array' | '[[1, 2], 3, "4"]' | new JsonValue.Array([new JsonValue.Array([new JsonValue.Integer('1'.chars), new JsonValue.Integer('2'.chars)]), new JsonValue.Integer('3'.chars), new JsonValue.StringValue('4'.chars)]) - 'object' | '{"1": 200, "3": "4"}' | new JsonValue.Object(['1': new JsonValue.Integer('200'.chars), '3': new JsonValue.StringValue('4'.chars)]) - '2d object' | '{"1": 2, "3": {"4":5}}' | new JsonValue.Object(['1': new JsonValue.Integer('2'.chars), '3': new JsonValue.Object(['4': new JsonValue.Integer('5'.chars)])]) - 'empty object' | '{}' | new JsonValue.Object([:]) - 'empty array' | '[]' | new JsonValue.Array([]) - 'empty string' | '""' | new JsonValue.StringValue(''.chars) + description | json | result + 'integer' | ' 1234' | new JsonValue.Integer('1234'.chars) + 'decimal' | ' 1234.56 ' | new JsonValue.Decimal('1234.56'.chars) + 'true' | 'true' | JsonValue.True.INSTANCE + 'false' | 'false' | JsonValue.False.INSTANCE + 'null' | 'null' | JsonValue.Null.INSTANCE + 'string' | '"null"' | new JsonValue.StringValue('null'.chars) + 'array' | '[1, 200, 3, "4"]' | new JsonValue.Array([new JsonValue.Integer('1'.chars), new JsonValue.Integer('200'.chars), new JsonValue.Integer('3'.chars), new JsonValue.StringValue('4'.chars)]) + '2d array' | '[[1, 2], 3, "4"]' | new JsonValue.Array([new JsonValue.Array([new JsonValue.Integer('1'.chars), new JsonValue.Integer('2'.chars)]), new JsonValue.Integer('3'.chars), new JsonValue.StringValue('4'.chars)]) + 'object' | '{"1": 200, "3": "4"}' | new JsonValue.Object(['1': new JsonValue.Integer('200'.chars), '3': new JsonValue.StringValue('4'.chars)]) + 'object with decimal value 1' | '{"1": 20.25}' | new JsonValue.Object(['1': new JsonValue.Decimal('20.25'.chars)]) + 'object with decimal value 2' | '{"1": 200.25}' | new JsonValue.Object(['1': new JsonValue.Decimal('200.25'.chars)]) + '2d object' | '{"1": 2, "3": {"4":5}}' | new JsonValue.Object(['1': new JsonValue.Integer('2'.chars), '3': new JsonValue.Object(['4': new JsonValue.Integer('5'.chars)])]) + 'empty object' | '{}' | new JsonValue.Object([:]) + 'empty array' | '[]' | new JsonValue.Array([]) + 'empty string' | '""' | new JsonValue.StringValue(''.chars) } def 'can parse a pact file'() {