From 63c398c01efc1d2e407dd8a5f9323043646e944f Mon Sep 17 00:00:00 2001 From: Phil Werli Date: Thu, 4 Jan 2024 18:55:02 +0100 Subject: [PATCH] Add tests --- .../refasterrules/OptionalRulesTestInput.java | 10 ++++++---- .../refasterrules/OptionalRulesTestOutput.java | 7 ++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java index c09719bea5d..652c7c6a61a 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java @@ -118,10 +118,12 @@ ImmutableSet> testOptionalOrOtherOptional() { ImmutableSet> testOptionalIdentity() { return ImmutableSet.of( - Optional.of("foo").stream().findFirst(), - Optional.of("bar").stream().findAny(), - Optional.of("baz").stream().min(String::compareTo), - Optional.of("qux").stream().max(String::compareTo)); + Optional.of("foo").or(() -> Optional.empty()), + Optional.of("bar").or(Optional::empty), + Optional.of("baz").stream().findFirst(), + Optional.of("qux").stream().findAny(), + Optional.of("corge").stream().min(String::compareTo), + Optional.of("grault").stream().max(String::compareTo)); } ImmutableSet> testOptionalFilter() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java index 88815292474..3506eb477e4 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java @@ -115,7 +115,12 @@ ImmutableSet> testOptionalOrOtherOptional() { ImmutableSet> testOptionalIdentity() { return ImmutableSet.of( - Optional.of("foo"), Optional.of("bar"), Optional.of("baz"), Optional.of("qux")); + Optional.of("foo"), + Optional.of("bar"), + Optional.of("baz"), + Optional.of("qux"), + Optional.of("corge"), + Optional.of("grault")); } ImmutableSet> testOptionalFilter() {