![JAR search and dependency download from the Maven repository](/logo.png)
com.objogate.wl.swing.probe.ValueMatcherProbe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of windowlicker-swing Show documentation
Show all versions of windowlicker-swing Show documentation
This is the Windowlicker Swing library.
The newest version!
package com.objogate.wl.swing.probe;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import com.objogate.wl.Probe;
public class ValueMatcherProbe implements Probe {
private final Matcher super T> matcher;
private final String message;
private boolean hasReceivedAValue = false;
private T receivedValue;
public ValueMatcherProbe(Matcher super T> matcher, String message) {
this.matcher = matcher;
this.message = message;
}
public void describeFailureTo(Description description) {
description.appendText(message).appendText(" ").appendDescriptionOf(matcher).appendText(". ");
if (hasReceivedAValue) {
description.appendText(". Received: ").appendValue(receivedValue);
} else {
description.appendText(" Received nothing");
}
}
public boolean isSatisfied() {
return matcher.matches(receivedValue);
}
public void probe() {
// nothing to do.
}
public void describeTo(Description description) {
description.appendText(message).appendText(" ").appendDescriptionOf(matcher);
}
public void setReceivedValue(T receivedValue) {
this.receivedValue = receivedValue;
this.hasReceivedAValue = true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy