Skip to content

Commit

Permalink
Assert on single root validation error message.
Browse files Browse the repository at this point in the history
This fixes an issue in CL/377369297 that required asserting each line of the error separately.

RELNOTES=N/A
PiperOrigin-RevId: 377386296
  • Loading branch information
bcorso authored and Dagger Team committed Jun 3, 2021
1 parent 48a076d commit c1359a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
Expand Up @@ -91,13 +91,10 @@ public void appRootTest() {
assertThat(compilation)
.hadErrorContaining(
"Cannot process new app roots when there are app roots from a "
+ "previous compilation unit:");
assertThat(compilation)
.hadErrorContaining(
"App roots in previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyAppPreviousCompilation.MyApp");
assertThat(compilation)
.hadErrorContaining("App roots in this compilation unit: test.AppRoot");
+ "previous compilation unit:"
+ "\n App roots in previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyAppPreviousCompilation.MyApp"
+ "\n App roots in this compilation unit: test.AppRoot");
}
}
}
Expand Up @@ -72,14 +72,10 @@ public void testRootTest() {
assertThat(compilation).hadErrorCount(1);
assertThat(compilation)
.hadErrorContaining(
"Cannot process new roots when there are test roots from a previous compilation"
+ " unit:");
assertThat(compilation)
.hadErrorContaining(
"Test roots from previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyTestPreviousCompilation.MyTest");
assertThat(compilation)
.hadErrorContaining("All roots from this compilation unit: test.TestRoot");
"Cannot process new roots when there are test roots from a previous compilation unit:"
+ "\n Test roots from previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyTestPreviousCompilation.MyTest"
+ "\n All roots from this compilation unit: test.TestRoot");
}
}

Expand All @@ -104,14 +100,10 @@ public void appRootTest() {
assertThat(compilation).hadErrorCount(1);
assertThat(compilation)
.hadErrorContaining(
"Cannot process new roots when there are test roots from a previous compilation"
+ " unit:");
assertThat(compilation)
.hadErrorContaining(
"Test roots from previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyTestPreviousCompilation.MyTest");
assertThat(compilation)
.hadErrorContaining("All roots from this compilation unit: test.AppRoot");
"Cannot process new roots when there are test roots from a previous compilation unit:"
+ "\n Test roots from previous compilation unit: "
+ "dagger.hilt.processor.internal.root.MyTestPreviousCompilation.MyTest"
+ "\n All roots from this compilation unit: test.AppRoot");
}
}
}
Expand Up @@ -115,9 +115,8 @@ public void appRootWithTestRootTest() {
assertThat(compilation).hadErrorCount(1);
assertThat(compilation)
.hadErrorContaining(
"Cannot process test roots and app roots in the same compilation unit:");
assertThat(compilation).hadErrorContaining("App root in this compilation unit: test.AppRoot");
assertThat(compilation)
.hadErrorContaining("Test roots in this compilation unit: test.TestRoot");
"Cannot process test roots and app roots in the same compilation unit:"
+ "\n App root in this compilation unit: test.AppRoot"
+ "\n Test roots in this compilation unit: test.TestRoot");
}
}

0 comments on commit c1359a2

Please sign in to comment.