All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.objogate.wl.swing.matcher.ScrollBarMatcher Maven / Gradle / Ivy

The newest version!
package com.objogate.wl.swing.matcher;

import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import java.awt.Container;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;

public class ScrollBarMatcher extends TypeSafeMatcher {
    private final Container parent;
    private final int orientation;

    public ScrollBarMatcher(JScrollPane pane, int orientation) {
        parent = pane;
        this.orientation = orientation;
    }

    @Override
    public boolean matchesSafely(JScrollBar component) {
        return parent == component.getParent() && component.getOrientation() == orientation;
    }

    public void describeTo(Description description) {
        description.appendText("scrollbar");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy