Java Code Examples for android.support.test.internal.util.Checks

The following are top voted examples for showing how to use android.support.test.internal.util.Checks. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: redux-android-sample   File: Matchers.java   View source code 5 votes vote down vote up
public static Matcher<View> withBGColor(final int color) {
    Checks.checkNotNull(color);
    return new BoundedMatcher<View, View>(View.class) {
        @Override
        public boolean matchesSafely(View view) {
            int currentColor = ((ColorDrawable) view.getBackground()).getColor();
            return color == currentColor;
        }
        @Override
        public void describeTo(Description description) {
            description.appendText("with background color: " + color);
        }
    };
}
 
Example 2
Project: Scoops   File: TestUtils.java   View source code 5 votes vote down vote up
public static Matcher<View> withTextColor(final int color) {
    Checks.checkNotNull(color);
    return new BoundedMatcher<View, TextView>(TextView.class) {
        @Override
        public boolean matchesSafely(TextView warning) {
            return color == warning.getCurrentTextColor();
        }
        @Override
        public void describeTo(Description description) {
            description.appendText("with text color: ");
        }
    };
}
 
Example 3
Project: restcomm-android-sdk   File: BasicUITests.java   View source code 5 votes vote down vote up
public static Matcher<View> withTextColor(final int color) {
    Checks.checkNotNull(color);
    return new BoundedMatcher<View, TextView>(TextView.class) {
        @Override
        public boolean matchesSafely(TextView textView) {
            return color == textView.getCurrentTextColor();
        }
        @Override
        public void describeTo(Description description) {
            description.appendText("Expected Color: " + color);
        }
    };
}