io.apptik.json.generator.matcher.SchemaCompositeMatchers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-generator Show documentation
Show all versions of json-generator Show documentation
Json data generator from json-schema using JustJson lib
package io.apptik.json.generator.matcher;
import io.apptik.json.schema.Schema;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
public class SchemaCompositeMatchers {
private SchemaCompositeMatchers() {}
public static Matcher hasAnyOf() {
return new ComparableTypeSafeMatcher() {
@Override
protected boolean matchesSafely(Schema item) {
if(item.getAnyOf() == null || !item.getAnyOf().isEmpty()) return false;
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("Has anyOf section");
}
};
}
public static Matcher hasOneOf() {
return new ComparableTypeSafeMatcher() {
@Override
protected boolean matchesSafely(Schema item) {
if(item.getOneOf() == null || item.getOneOf().isEmpty()) return false;
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("Has anyOf section");
}
};
}
public static Matcher hasAllOf() {
return new ComparableTypeSafeMatcher() {
@Override
protected boolean matchesSafely(Schema item) {
if(item.getAllOf() == null || !item.getAllOf().isEmpty()) return false;
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("Has anyOf section");
}
};
}
}