From 358bb5b89b70bde814464ec1c8d7f7a2bda5cb23 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Mon, 7 Jun 2021 12:16:41 +0200 Subject: [PATCH] Added tests for jsonpath compatibility with matchers; fixes gh-57 --- .../toomuchcoding/jsonassert/JsonAssertionSpec.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jsonassert/src/test/groovy/com/toomuchcoding/jsonassert/JsonAssertionSpec.groovy b/jsonassert/src/test/groovy/com/toomuchcoding/jsonassert/JsonAssertionSpec.groovy index dd56195..131f48e 100644 --- a/jsonassert/src/test/groovy/com/toomuchcoding/jsonassert/JsonAssertionSpec.groovy +++ b/jsonassert/src/test/groovy/com/toomuchcoding/jsonassert/JsonAssertionSpec.groovy @@ -849,4 +849,14 @@ class JsonAssertionSpec extends Specification { noExceptionThrown() } + @Issue('#57') + def 'should work with matchers'() { + given: + String json = '''{ "value": -1}''' + when: + assertThatJson(json).field("['value']").matches("-?(\\d+)") + then: + noExceptionThrown() + } + }