Browse Source

Restore deprecated constructor for binary compatibility support

Code that compiles against the non-deprecated version does not see the
new constructor that has been introduced. As such, there is no way for
them to migrate to it without resorting to reflection.

This commit restores the deprecated constructor so that people can try
the latest version more easily.

Closes gh-34238
pull/34242/head
Stéphane Nicoll 1 year ago
parent
commit
4d0f1729cb
  1. 14
      spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java

14
spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -82,6 +82,18 @@ public class JsonPathExpectationsHelper { @@ -82,6 +82,18 @@ public class JsonPathExpectationsHelper {
this.configuration = (configuration != null) ? configuration : Configuration.defaultConfiguration();
}
/**
* Construct a new {@code JsonPathExpectationsHelper}.
* @param expression the {@link JsonPath} expression; never {@code null} or empty
* @param args arguments to parameterize the {@code JsonPath} expression with,
* using formatting specifiers defined in {@link String#format(String, Object...)}
* @deprecated in favor of calling {@link String#formatted(Object...)} upfront
*/
@Deprecated(since = "6.2", forRemoval = true)
public JsonPathExpectationsHelper(String expression, Object... args) {
this(expression.formatted(args), (Configuration) null);
}
/**
* Evaluate the JSON path expression against the supplied {@code content}

Loading…
Cancel
Save