![JAR search and dependency download from the Maven repository](/logo.png)
com.objogate.wl.swing.probe.ComponentPropertyAssertionProbe 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.Probe;
import com.objogate.wl.Query;
import com.objogate.wl.swing.ComponentSelector;
public class ComponentPropertyAssertionProbe implements Probe {
private final ComponentSelector selector;
private final Query super C, P> propertyValueQuery;
private final Matcher super P> propertyValueMatcher;
private P propertyValue;
public ComponentPropertyAssertionProbe(ComponentSelector selector, Query super C, P> propertyValueQuery, Matcher super P> propertyValueMatcher) {
this.selector = selector;
this.propertyValueQuery = propertyValueQuery;
this.propertyValueMatcher = propertyValueMatcher;
}
public void probe() {
selector.probe();
if (selector.isSatisfied()) {
propertyValue = propertyValueQuery.query(selector.component());
}
}
public boolean isSatisfied() {
return selector.isSatisfied() && propertyValueMatcher.matches(propertyValue);
}
public void describeTo(Description description) {
description
.appendDescriptionOf(selector)
.appendText("\nand check that its ")
.appendDescriptionOf(propertyValueQuery)
.appendText(" is ")
.appendDescriptionOf(propertyValueMatcher);
}
public void describeFailureTo(Description description) {
selector.describeFailureTo(description);
if (selector.isSatisfied()) {
description.appendText("\n ")
.appendDescriptionOf(propertyValueQuery)
.appendText(" was ")
.appendValue(propertyValue);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy