![JAR search and dependency download from the Maven repository](/logo.png)
com.objogate.wl.swing.probe.ComponentAssertionProbe 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 java.awt.Component;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import com.objogate.wl.swing.ComponentFinder;
import com.objogate.wl.swing.ComponentSelector;
public class ComponentAssertionProbe implements ComponentFinder {
private final ComponentSelector selector;
private final Matcher super T> assertion;
private boolean assertionMet = false;
public ComponentAssertionProbe(ComponentSelector selector, Matcher super T> assertion) {
this.assertion = assertion;
this.selector = selector;
}
public java.util.List components() {
return selector.components();
}
public void probe() {
selector.probe();
assertionMet = selector.isSatisfied() && assertion.matches(selector.component());
}
public boolean isSatisfied() {
return assertionMet;
}
public void describeTo(Description description) {
description.appendDescriptionOf(selector)
.appendText("\nand check that it is ")
.appendDescriptionOf(assertion);
}
public void describeFailureTo(Description description) {
selector.describeFailureTo(description);
if (selector.isSatisfied()) {
description.appendText("\n it ")
.appendText(assertionMet ? "is " : "is not ")
.appendDescriptionOf(assertion);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy