diff options
author | Amr Afifiy <amrmahmoud@google.com> | 2022-11-02 09:24:30 +0000 |
---|---|---|
committer | Amr Afifiy <amrmahmoud@google.com> | 2022-11-02 09:24:30 +0000 |
commit | b27402ab63bc12bef9ebc6225f0c16c6efb5246a (patch) | |
tree | 776eb2b5ab0ca65236ef283df1a8ac84b16cd33c | |
parent | baa4932766db92480a80e84e0724a736df555da0 (diff) | |
download | data-binding-b27402ab63bc12bef9ebc6225f0c16c6efb5246a.tar.gz |
Update databinding tests after enabling non transitive R classes
Bug: 243780001
Test: updating tests
Change-Id: I86960ed78dc4cb5d48fe95eb89edb5c37ce9207c
2 files changed, 7 insertions, 3 deletions
diff --git a/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt index d9db7ab8..957b8f86 100644 --- a/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt +++ b/compilationTests/src/test/java/androidx/databinding/compilationTest/SimpleCompilationTest.kt @@ -19,6 +19,7 @@ import android.databinding.tool.processing.ErrorMessages import android.databinding.tool.processing.ScopedException import android.databinding.tool.util.FileUtil import com.google.common.base.Joiner +import com.google.common.truth.Truth.assertThat import org.apache.commons.io.FileUtils import org.apache.commons.io.filefilter.NameFileFilter import org.apache.commons.io.filefilter.PrefixFileFilter @@ -385,7 +386,10 @@ class SimpleCompilationTest : DataBindingCompilationTestCase() { val result = assembleDebug() Assert.assertNotEquals(0, result.resultCode.toLong()) val errors = ScopedException.extractErrors(result.error) - Assert.assertEquals(result.error, 1, errors.size.toLong()) + + // mergeDebugResources and packageDebugResources might both generate the same error, so we + // take the first error + assertThat(errors).isNotEmpty() val ex = errors[0] val report = ex.scopedErrorReport val errorFile = requireErrorFile(report) diff --git a/integration-tests-support/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java b/integration-tests-support/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java index 93ae3cde..9b3980ae 100644 --- a/integration-tests-support/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java +++ b/integration-tests-support/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java @@ -38,7 +38,7 @@ public class GeneratedLayoutTest { public void run() { LayoutInflater inflater = LayoutInflater.from( InstrumentationRegistry.getTargetContext()); - View view = inflater.inflate(R.layout.library_layout, null); + View view = inflater.inflate(android.databinding.test.independentlibrary.R.layout.library_layout, null); // force override tag view.setTag("layout/library_layout_0"); ViewDataBinding bind = DataBindingUtil.bind(view); @@ -55,7 +55,7 @@ public class GeneratedLayoutTest { public void run() { LayoutInflater inflater = LayoutInflater.from( InstrumentationRegistry.getTargetContext()); - View view = inflater.inflate(R.layout.library_layout, null); + View view = inflater.inflate(android.databinding.test.independentlibrary.R.layout.library_layout, null); // force override tag view.setTag("layout-sw600dp-land/library_layout_0"); ViewDataBinding bind = DataBindingUtil.bind(view); |