LibraryActivityTest.java revision fead9ca09b117136b35bc5bf137340a754f9eddd
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.databinding.test.independentlibrary;
18
19import android.test.ActivityInstrumentationTestCase2;
20import android.view.View;
21import android.widget.TextView;
22
23public class LibraryActivityTest extends ActivityInstrumentationTestCase2<LibraryActivity> {
24    public LibraryActivityTest() {
25        super(LibraryActivity.class);
26    }
27
28    public void testTextViewContents() throws Throwable {
29        final LibraryActivity activity = getActivity();
30        assertNotNull("test sanity", activity);
31        runTestOnUiThread(new Runnable() {
32            @Override
33            public void run() {
34                TextView textView = (TextView) activity.findViewById(R.id.fooTextView);
35                final String expected = LibraryActivity.FIELD_VALUE + " " +
36                        LibraryActivity.FIELD_VALUE;
37                assertEquals(expected, textView.getText().toString());
38            }
39        });
40    }
41}
42