Skip to content

Commit

Permalink
chore(allure-jsonunit): deprecate AllureConfigurableJsonMatcher in …
Browse files Browse the repository at this point in the history
…favor of `ConfigurableJsonMatcher` (via #1060)
  • Loading branch information
valfirst authored Jul 5, 2024
1 parent 71ec65c commit 5649230
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
import org.hamcrest.Matcher;

import net.javacrumbs.jsonunit.core.Configuration;
import net.javacrumbs.jsonunit.core.ConfigurationWhen.ApplicableForPath;
import net.javacrumbs.jsonunit.core.ConfigurationWhen.PathsParam;
import net.javacrumbs.jsonunit.core.Option;
import net.javacrumbs.jsonunit.core.internal.Diff;
import net.javacrumbs.jsonunit.core.internal.Options;
import net.javacrumbs.jsonunit.core.listener.DifferenceListener;

/**
* Сontains basic matcher functionality and implementation of methods for matching configuration.
* Contains basic matcher functionality and implementation of methods for matching configuration.
*
* @param <T> the type
*/
Expand Down Expand Up @@ -54,6 +56,11 @@ public T when(final Option first, final Option... next) {
return (T) this;
}

public T when(final PathsParam pathsParam, final ApplicableForPath... applicableForPaths) {
this.configuration = this.configuration.when(pathsParam, applicableForPaths);
return (T) this;
}

public T withOptions(final Options options) {
this.configuration = configuration.withOptions(options);
return (T) this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
/**
* @param <T> the type of matcher
* @see net.javacrumbs.jsonunit.ConfigurableJsonMatcher
* @deprecated Use {@link net.javacrumbs.jsonunit.ConfigurableJsonMatcher}
*/
@Deprecated
public interface AllureConfigurableJsonMatcher<T> extends Matcher<T> {

AllureConfigurableJsonMatcher<T> withTolerance(BigDecimal tolerance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.qameta.allure.attachment.DefaultAttachmentProcessor;
import io.qameta.allure.attachment.FreemarkerAttachmentRenderer;
import net.javacrumbs.jsonunit.ConfigurableJsonMatcher;
import net.javacrumbs.jsonunit.core.listener.DifferenceListener;

import org.hamcrest.Description;
Expand All @@ -28,16 +29,16 @@
* @param <T> the type
*/
@SuppressWarnings("unused")
public final class JsonPatchMatcher<T> extends AbstractJsonPatchMatcher<AllureConfigurableJsonMatcher<T>>
implements AllureConfigurableJsonMatcher<T> {
public final class JsonPatchMatcher<T> extends AbstractJsonPatchMatcher<ConfigurableJsonMatcher<T>>
implements ConfigurableJsonMatcher<T> {

private final Object expected;

private JsonPatchMatcher(final Object expected) {
this.expected = expected;
}

public static <T> AllureConfigurableJsonMatcher<T> jsonEquals(final Object expected) {
public static <T> ConfigurableJsonMatcher<T> jsonEquals(final Object expected) {
return new JsonPatchMatcher<T>(expected);
}

Expand Down

0 comments on commit 5649230

Please sign in to comment.