![JAR search and dependency download from the Maven repository](/logo.png)
com.objogate.wl.swing.probe.ComponentIdentity 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 java.util.Collections;
import org.hamcrest.Description;
import com.objogate.wl.swing.ComponentSelector;
/**
* A ComponentFinder that always find a given component.
*
* This is useful for unit-testing a component.
*/
public class ComponentIdentity implements ComponentSelector {
private final T component;
public ComponentIdentity(T component) {
this.component = component;
}
public static ComponentSelector selectorFor(U component) {
return new ComponentIdentity(component);
}
public T component() {
return component;
}
public java.util.List components() {
return Collections.singletonList(component);
}
public void probe() {
// Nothing to do
}
public boolean isSatisfied() {
return true;
}
public void describeTo(Description description) {
description.appendText(" the exact ");
description.appendText(component.getClass().getSimpleName());
description.appendText(" '");
description.appendValue(component.toString());
description.appendText("' ");
}
public void describeFailureTo(Description description) {
// Cannot fail
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy