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

org.hamcrest.junit.internal.Matching Maven / Gradle / Ivy

There is a newer version: 2.0.0.0
Show newest version
/*  Copyright (c) 2000-2006 hamcrest.org
 */
package org.hamcrest.junit.internal;


import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;

public class Matching {
    public static  void checkMatch(String reason, T actual, Matcher matcher, MismatchAction action) {
        if (!matcher.matches(actual)) {
            Description description = new StringDescription();
            description.appendText(reason)
                       .appendText("\nExpected: ")
                       .appendDescriptionOf(matcher)
                       .appendText("\n     but: ");
            matcher.describeMismatch(actual, description);
            
            action.mismatch(description.toString());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy