com.objogate.wl.swing.driver.JProgressBarDriver 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.driver;
import javax.swing.JProgressBar;
import java.awt.Component;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import com.objogate.wl.Prober;
import com.objogate.wl.swing.ComponentSelector;
import com.objogate.wl.swing.gesture.GesturePerformer;
public class JProgressBarDriver extends JComponentDriver {
public JProgressBarDriver(GesturePerformer gesturePerformer, ComponentSelector jProgressBarComponentSelector, Prober prober) {
super(gesturePerformer, jProgressBarComponentSelector, prober);
}
public JProgressBarDriver(ComponentDriver extends Component> parentOrOwner, ComponentSelector jProgressBarComponentSelector) {
super(parentOrOwner, jProgressBarComponentSelector);
}
public JProgressBarDriver(ComponentDriver extends Component> parentOrOwner, Class componentType, Matcher super JProgressBar>... matchers) {
super(parentOrOwner, componentType, matchers);
}
public void hasMinimum(final Matcher matcher) {
is(new TypeSafeMatcher() {
@Override
public boolean matchesSafely(JProgressBar jProgressBar) {
return matcher.matches(jProgressBar.getMinimum());
}
public void describeTo(Description description) {
description.appendText("minimumvalue matches");
description.appendDescriptionOf(matcher);
}
});
}
public void hasMaximum(final Matcher matcher) {
is(new TypeSafeMatcher() {
@Override
public boolean matchesSafely(JProgressBar jProgressBar) {
return matcher.matches(jProgressBar.getMaximum());
}
public void describeTo(Description description) {
description.appendText("maximumvalue matches");
description.appendDescriptionOf(matcher);
}
});
}
public void hasValue(final Matcher matcher) {
is(new TypeSafeMatcher() {
@Override
public boolean matchesSafely(JProgressBar jProgressBar) {
return matcher.matches(jProgressBar.getValue());
}
public void describeTo(Description description) {
description.appendText("value matches");
description.appendDescriptionOf(matcher);
}
});
}
public void hasString(final Matcher matcher) {
is(new TypeSafeMatcher() {
@Override
public boolean matchesSafely(JProgressBar jProgressBar) {
return matcher.matches(jProgressBar.getString());
}
public void describeTo(Description description) {
description.appendText("string matches");
description.appendDescriptionOf(matcher);
}
});
}
public void hasPercentComplete(final Matcher matcher) {
is(new TypeSafeMatcher() {
@Override
public boolean matchesSafely(JProgressBar jProgressBar) {
return matcher.matches(jProgressBar.getPercentComplete());
}
public void describeTo(Description description) {
description.appendText("percentage matches");
description.appendDescriptionOf(matcher);
}
});
}
}