All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.apptik.json.generator.matcher.SchemaCompositeMatchers Maven / Gradle / Ivy

There is a newer version: 1.1.0-alpha1
Show newest version
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");
            }
        };
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy