aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java17
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java24
2 files changed, 22 insertions, 19 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
index ddf12ff3..2a5f55a0 100644
--- a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
@@ -58,14 +58,15 @@ public final class AutoBuilderCompilationTest {
"",
" @Override",
" public Baz build() {",
- " String missing = \"\";",
- " if (this.anInt == null) {",
- " missing += \" anInt\";",
- " }",
- " if (this.aString == null) {",
- " missing += \" aString\";",
- " }",
- " if (!missing.isEmpty()) {",
+ " if (this.anInt == null",
+ " || this.aString == null) {",
+ " StringBuilder missing = new StringBuilder();",
+ " if (this.anInt == null) {",
+ " missing.append(\" anInt\");",
+ " }",
+ " if (this.aString == null) {",
+ " missing.append(\" aString\");",
+ " }",
" throw new IllegalStateException(\"Missing required properties:\" + missing);",
" }",
" return new Baz(",
diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java
index 4d9026ac..1baf4b4d 100644
--- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java
@@ -1311,17 +1311,19 @@ public class AutoValueCompilationTest {
+ "NestedAutoValue.builder();",
" this.aNestedAutoValue = aNestedAutoValue$builder.build();",
" }",
- " String missing = \"\";",
- " if (this.anInt == null) {",
- " missing += \" anInt\";",
- " }",
- " if (this.aByteArray == null) {",
- " missing += \" aByteArray\";",
- " }",
- " if (this.aList == null) {",
- " missing += \" aList\";",
- " }",
- " if (!missing.isEmpty()) {",
+ " if (this.anInt == null",
+ " || this.aByteArray == null",
+ " || this.aList == null) {",
+ " StringBuilder missing = new StringBuilder();",
+ " if (this.anInt == null) {",
+ " missing.append(\" anInt\");",
+ " }",
+ " if (this.aByteArray == null) {",
+ " missing.append(\" aByteArray\");",
+ " }",
+ " if (this.aList == null) {",
+ " missing.append(\" aList\");",
+ " }",
" throw new IllegalStateException(\"Missing required properties:\" + missing);",
" }",
" return new AutoValue_Baz<T>(",