Debian Codegraph @

integration-tests/TestApp/app/src/androidTest/java/android/databinding/DataBindingMapperTest.java

raw
1 /*
2 * Copyright (C) 2015 The Android Open Source Project
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
12 */
13
14 package android.databinding;
15
16
17 import android.test.AndroidTestCase;
18 import android.view.View;
19
20 public class DataBindingMapperTest extends AndroidTestCase {
21 public void testNotDataBindingId() {
22 View view = new View(getContext());
23 view.setTag("layout/unexpected");
24 android.databinding.DataBinderMapper mapper = new android.databinding.DataBinderMapper();
25 ViewDataBinding binding = mapper.getDataBinder(null, view, 1);
26 assertNull(binding);
27 }
28 public void testInvalidView() {
29 View view = new View(getContext());
30 view.setTag("layout/unexpected");
31 android.databinding.DataBinderMapper mapper = new android.databinding.DataBinderMapper();
32 Throwable error = null;
33 try {
34 mapper.getDataBinder(null, view, android.databinding.testapp.R.layout.multi_res_layout);
35 } catch (Throwable t) {
36 error = t;
37 }
38 assertNotNull(error);
39 assertEquals("The tag for multi_res_layout is invalid. Received: layout/unexpected",
40 error.getMessage());
41
42 }
43 }