OptionalResultWithMessagesSubject: Add @CanIgnoreReturnValue annotations
For methods that return the instance to allow chaining calls the return
value may be ignored.
Not marking these methods with the @CanIgnoreReturnValue annotation
block us (Google) from importing the recent code changes.
Change-Id: I0f14ae17ff4f1ffa63f038f359331f2db795ebb4
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/java/com/google/gerrit/plugins/codeowners/testing/OptionalResultWithMessagesSubject.java b/java/com/google/gerrit/plugins/codeowners/testing/OptionalResultWithMessagesSubject.java
index 0f6cf34..c19a576 100644
--- a/java/com/google/gerrit/plugins/codeowners/testing/OptionalResultWithMessagesSubject.java
+++ b/java/com/google/gerrit/plugins/codeowners/testing/OptionalResultWithMessagesSubject.java
@@ -21,6 +21,7 @@
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.IterableSubject;
import com.google.common.truth.Subject;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.gerrit.plugins.codeowners.backend.DebugMessage;
import com.google.gerrit.plugins.codeowners.backend.OptionalResultWithMessages;
import java.util.Optional;
@@ -60,6 +61,7 @@
check("result()").about(optionals()).that(optionalResultWithMessages().result()).isEmpty();
}
+ @CanIgnoreReturnValue
public OptionalResultWithMessagesSubject assertContainsAdminOnlyMessage(
String expectedAdminMessage) {
hasAdminMessagesThat().contains(expectedAdminMessage);
@@ -67,12 +69,14 @@
return this;
}
+ @CanIgnoreReturnValue
public OptionalResultWithMessagesSubject assertContainsMessage(String expectedMessage) {
hasAdminMessagesThat().contains(expectedMessage);
hasUserMessagesThat().contains(expectedMessage);
return this;
}
+ @CanIgnoreReturnValue
public OptionalResultWithMessagesSubject assertContainsMessage(
String expectedAdminMessage, String expectedUserMessage) {
hasAdminMessagesThat().contains(expectedAdminMessage);
@@ -80,6 +84,7 @@
return this;
}
+ @CanIgnoreReturnValue
public OptionalResultWithMessagesSubject assertContainsExactlyMessage(String expectedMessage) {
hasAdminMessagesThat().containsExactly(expectedMessage);
hasUserMessagesThat().containsExactly(expectedMessage);