diff --git a/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy b/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy index 87b940c663..c18a918c8b 100644 --- a/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy +++ b/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy @@ -179,6 +179,30 @@ class ContentUtils { }) } + /** + *
+ * If you wonder why there is val[1] without null-check then take a look at this: + *
+ *+ * Example: + *
+ *+ * Our string equals: {@code EXECUTION>>assertThatRejectionReasonIsNull($it)<<} + * The matcher matches this group with the pattern {@code EXECUTION>>(.*)<<} + *
+ *+ * So {@code executionMatcher[0]} returns 2 elements: + *
+ * Thus one can safely write {@code executionMatcher[0][1]} to retrieve the matched group + *
+ * @param string to match the regexps against + * @return object converted from temporary holders + */ static Object returnParsedObject(String string) { Matcher matcher = TEMPORARY_PATTERN_HOLDER.matcher(string.trim()) if (matcher.matches()) {