diff options
Diffstat (limited to 'espresso/espresso-lib-tests/src/androidTest/java/com/google/android/apps/common/testing/ui/espresso/NoMatchingViewExceptionTest.java')
-rw-r--r-- | espresso/espresso-lib-tests/src/androidTest/java/com/google/android/apps/common/testing/ui/espresso/NoMatchingViewExceptionTest.java | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/espresso/espresso-lib-tests/src/androidTest/java/com/google/android/apps/common/testing/ui/espresso/NoMatchingViewExceptionTest.java b/espresso/espresso-lib-tests/src/androidTest/java/com/google/android/apps/common/testing/ui/espresso/NoMatchingViewExceptionTest.java deleted file mode 100644 index 16571e3..0000000 --- a/espresso/espresso-lib-tests/src/androidTest/java/com/google/android/apps/common/testing/ui/espresso/NoMatchingViewExceptionTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.android.apps.common.testing.ui.espresso; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; - -import android.test.AndroidTestCase; -import android.view.View; - -import org.hamcrest.Matcher; -import org.hamcrest.Matchers; -import org.hamcrest.StringDescription; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** Unit tests for {@link NoMatchingViewException}. */ -public class NoMatchingViewExceptionTest extends AndroidTestCase { - private Matcher<View> alwaysFailingMatcher; - - @Mock - private View testView; - - @Override - public void setUp() throws Exception { - super.setUp(); - MockitoAnnotations.initMocks(this); - alwaysFailingMatcher = Matchers.<View>nullValue(); - } - - public void testExceptionContainsMatcherDescription() { - StringBuilder matcherDescription = new StringBuilder(); - alwaysFailingMatcher.describeTo(new StringDescription(matcherDescription)); - assertThat(createException().getMessage(), containsString(matcherDescription.toString())); - } - - public void testExceptionContainsView() { - String exceptionMessage = createException().getMessage(); - - assertThat("missing root element" + exceptionMessage, exceptionMessage, - containsString("{id=0,")); - } - - private NoMatchingViewException createException() { - return new NoMatchingViewException.Builder() - .withViewMatcher(alwaysFailingMatcher) - .withRootView(testView) - .build(); - } -} |