Back to project page android-marvin.
The source code is released under:
Apache License
If you think the Android project android-marvin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.akquinet.android.marvin.matchers; //from ww w . j a va2 s . co m import static org.hamcrest.core.IsNot.not; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Factory; import org.hamcrest.Matcher; import android.view.View; public class IsVisible<T extends View> extends BaseMatcher<T> { public boolean matches(Object o) { if (!(o instanceof View)) { throw new IllegalArgumentException("not a view"); } return ((View) o).getVisibility() == View.VISIBLE; } public void describeTo(Description description) { description.appendText("visible"); } @Factory public static <T extends View> Matcher<T> isVisible() { return new IsVisible<T>(); } @Factory public static <T extends View> Matcher<T> isNotVisible() { return not(new IsVisible<T>()); } }