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

org.dmfs.jems.hamcrest.matchers.matcher.MatcherMatcher Maven / Gradle / Ivy

There is a newer version: 1.44
Show newest version
/*
 * Copyright 2018 dmfs GmbH
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.dmfs.jems.hamcrest.matchers.matcher;

import org.hamcrest.Matcher;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.any;


/**
 * Collection of static matcher factories to test {@link Matcher}s.
 *
 * @author Marten Gajda
 */
public final class MatcherMatcher
{
    public static  Matcher> matches(V value)
    {
        return new MatchMatcher<>(value);
    }


    public static  Matcher> describesAs(String description)
    {
        return describesAs(is(description));
    }


    public static  Matcher> describesAs(Matcher descriptionMatcher)
    {
        return new DescriptionMatcher<>(descriptionMatcher);
    }


    public static  Matcher> mismatches(V value)
    {
        return new MismatchMatcher<>(value, any(String.class));
    }


    public static  Matcher> mismatches(V value, String mismatchDescription)
    {
        return new MismatchMatcher<>(value, is(mismatchDescription));
    }


    public static  Matcher> mismatches(V value, Matcher mismatchDescriptionMatcher)
    {
        return new MismatchMatcher<>(value, mismatchDescriptionMatcher);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy