From 4ccc8397f05f42a6b0db59d5147b88835f6e7b67 Mon Sep 17 00:00:00 2001 From: Chaoren Lin Date: Tue, 3 Jan 2023 12:42:38 -0800 Subject: [PATCH] Update Error Prone tests for the Android Lint version of `CheckReturnValue`. PiperOrigin-RevId: 499291765 --- .../bugpatterns/CheckReturnValueTest.java | 16 ++++++------ ...heckReturnValueWellKnownLibrariesTest.java | 26 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java index d5e6dc009453..6ff1b0f2708e 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java @@ -107,7 +107,7 @@ public void negativeCase() { public void packageAnnotation() { compilationHelper .addSourceLines( - "package-info.java", // + "lib/package-info.java", // "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -153,7 +153,7 @@ public void classAnnotation() { public void voidReturningMethodInAnnotatedPackage() { compilationHelper .addSourceLines( - "package-info.java", // + "lib/package-info.java", // "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -176,7 +176,7 @@ public void voidReturningMethodInAnnotatedPackage() { public void badCRVOnProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -191,7 +191,7 @@ public void badCRVOnProcedure() { public void badCRVOnPseudoProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -208,7 +208,7 @@ public void badCRVOnPseudoProcedure() { public void packageAnnotationButCanIgnoreReturnValue() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -253,7 +253,7 @@ public void classAnnotationButCanIgnoreReturnValue() { public void badCanIgnoreReturnValueOnProcedure() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "@com.google.errorprone.annotations.CheckReturnValue", "public class Test {", @@ -318,7 +318,7 @@ public void nestedClassWithCanIgnoreAnnotation() { public void packageWithCanIgnoreAnnotation() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( @@ -371,7 +371,7 @@ public void errorBothMethod() { public void javaLangVoidReturningMethodInAnnotatedPackage() { compilationHelper .addSourceLines( - "package-info.java", + "lib/package-info.java", "@com.google.errorprone.annotations.CheckReturnValue", "package lib;") .addSourceLines( diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/checkreturnvalue/CheckReturnValueWellKnownLibrariesTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/checkreturnvalue/CheckReturnValueWellKnownLibrariesTest.java index 9b19fdec9da6..e9002f1e67f7 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/checkreturnvalue/CheckReturnValueWellKnownLibrariesTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/checkreturnvalue/CheckReturnValueWellKnownLibrariesTest.java @@ -47,7 +47,7 @@ public class CheckReturnValueWellKnownLibrariesTest { public void ignoreCRVOnMockito() { compilationHelper .addSourceLines( - "Test.java", + "lib/Test.java", "package lib;", "public class Test {", " @com.google.errorprone.annotations.CheckReturnValue", @@ -418,7 +418,7 @@ public void usingElementInTestExpected() { public void autoValueBuilderSetterMethods() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -438,7 +438,7 @@ public void autoValueBuilderSetterMethods() { " }", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -456,7 +456,7 @@ public void autoValueBuilderSetterMethods() { public void autoValueBuilderSetterMethodsOnInterface() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -479,7 +479,7 @@ public void autoValueBuilderSetterMethodsOnInterface() { " }", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -499,7 +499,7 @@ public void autoValueBuilderSetterMethodsOnInterface() { public void autoValueGetterMethods() { compilationHelper .addSourceLines( - "Animal.java", + "com/google/frobber/Animal.java", "package com.google.frobber;", "import com.google.auto.value.AutoValue;", "@AutoValue", @@ -508,7 +508,7 @@ public void autoValueGetterMethods() { " abstract int numberOfLegs();", "}") .addSourceLines( - "AnimalCaller.java", + "com/google/frobber/AnimalCaller.java", "package com.google.frobber;", "public final class AnimalCaller {", " static void testAnimal() {", @@ -529,13 +529,13 @@ public void autoValueGetterMethods() { public void autoBuilderSetterMethods() { compilationHelper .addSourceLines( - "Person.java", + "com/google/frobber/Person.java", "package com.google.frobber;", "public final class Person {", " public Person(String name, int id) {}", "}") .addSourceLines( - "PersonBuilder.java", + "com/google/frobber/PersonBuilder.java", "package com.google.frobber;", "import com.google.auto.value.AutoBuilder;", "import com.google.errorprone.annotations.CheckReturnValue;", @@ -550,7 +550,7 @@ public void autoBuilderSetterMethods() { " Person build();", "}") .addSourceLines( - "PersonCaller.java", + "com/google/frobber/PersonCaller.java", "package com.google.frobber;", "public final class PersonCaller {", " static void testPersonBuilder() {", @@ -574,14 +574,14 @@ public void autoBuilderSetterMethods() { public void autoBuilderSetterMethods_withInterface() { compilationHelper .addSourceLines( - "LogUtil.java", + "com/google/frobber/LogUtil.java", "package com.google.frobber;", "import java.util.logging.Level;", "public class LogUtil {", " public static void log(Level severity, String message) {}", "}") .addSourceLines( - "Caller.java", + "com/google/frobber/Caller.java", "package com.google.frobber;", "import com.google.auto.value.AutoBuilder;", "import java.util.logging.Level;", @@ -597,7 +597,7 @@ public void autoBuilderSetterMethods_withInterface() { " void call(); // calls: LogUtil.log(severity, message)", "}") .addSourceLines( - "LogCaller.java", + "com/google/frobber/LogCaller.java", "package com.google.frobber;", "import java.util.logging.Level;", "public final class LogCaller {",