
org.fuwjin.util.Matchers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glory Show documentation
Show all versions of glory Show documentation
There's a nice knock-down argument for you
package org.fuwjin.util;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
public class Matchers {
public static Matcher stringValue(final T value) {
return new BaseMatcher() {
@Override
public void describeTo(final Description description) {
description.appendValue("(" + value.getClass().getCanonicalName() + ")" + value);
}
@Override
public boolean matches(final Object item) {
if(item == null) {
return value == null;
}
if(value == null) {
return false;
}
return item.getClass().equals(value.getClass()) && item.toString().equals(value.toString());
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy