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 */ 16package android.databinding.testapp; 17 18import android.databinding.testapp.databinding.FindFieldTestBinding; 19import android.databinding.testapp.vo.FindFieldBindingObject; 20import android.test.UiThreadTest; 21 22public class FindFieldTest extends BaseDataBinderTest<FindFieldTestBinding> { 23 public FindFieldTest() { 24 super(FindFieldTestBinding.class); 25 } 26 27 @UiThreadTest 28 public void test() { 29 initBinder(); 30 FindFieldBindingObject obj = new FindFieldBindingObject(); 31 obj.mPublicField = "foo"; 32 mBinder.setObj(obj); 33 mBinder.executePendingBindings(); 34 assertEquals(obj.mPublicField, mBinder.textView1.getText().toString()); 35 } 36 37 @UiThreadTest 38 public void testFieldOnGeneric() { 39 initBinder(); 40 mBinder.executePendingBindings(); 41 assertEquals("Hello", mBinder.textView2.getText().toString()); 42 } 43} 44