diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsageTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsageTest.java index 1250fa5349..ad4e8a8b07 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsageTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsageTest.java @@ -1,17 +1,11 @@ package tech.picnic.errorprone.bugpatterns; -import static com.google.common.base.Predicates.containsPattern; - import com.google.errorprone.CompilationTestHelper; import org.junit.jupiter.api.Test; final class TimeZoneUsageTest { private final CompilationTestHelper compilationHelper = - CompilationTestHelper.newInstance(TimeZoneUsage.class, getClass()) - .expectErrorMessage( - "X", - containsPattern( - "Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone")); + CompilationTestHelper.newInstance(TimeZoneUsage.class, getClass()); @Test void identification() { @@ -39,68 +33,68 @@ void identification() { " Clock.offset(clock, Duration.ZERO);", " Clock.tick(clock, Duration.ZERO);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.systemUTC();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.systemDefaultZone();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.system(UTC);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.tickMillis(UTC);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.tickMinutes(UTC);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Clock.tickSeconds(UTC);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " clock.getZone();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " clock.withZone(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " Instant.now();", " // This is equivalent to `clock.instant()`, which is fine.", " Instant.now(clock);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDate.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDate.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDate.now(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDateTime.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDateTime.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalDateTime.now(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalTime.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalTime.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " LocalTime.now(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetDateTime.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetDateTime.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetDateTime.now(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetTime.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetTime.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " OffsetTime.now(UTC);", "", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " ZonedDateTime.now();", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " ZonedDateTime.now(clock);", - " // BUG: Diagnostic matches: X", + " // BUG: Diagnostic contains:", " ZonedDateTime.now(UTC);", " }", "",