Add Errorprone plugin for removing FQCNs (#3021)

These annoy me and AI loves to add them. Let's automatically remove them.
This commit is contained in:
gbrodman
2026-04-23 20:17:19 +00:00
committed by GitHub
parent 925482ea58
commit 903414c76b
19 changed files with 67 additions and 67 deletions
@@ -135,7 +135,7 @@ public class ResaveAllEppResourcesPipelineTest {
persistDomainWithDependentResources(
"domain", "tld", toDateTime(now), toDateTime(now), toDateTime(plusYears(now, 1)));
assertThat(loadAllOf(GracePeriod.class)).hasSize(1);
fakeClock.advanceBy(org.joda.time.Duration.standardDays(500));
fakeClock.advanceBy(Duration.standardDays(500));
runPipeline();
assertThat(loadAllOf(GracePeriod.class)).isEmpty();
}
@@ -46,6 +46,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import google.registry.flows.EppException;
import google.registry.flows.EppException.UnimplementedCommandException;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.FlowUtils.NotLoggedInException;
import google.registry.flows.FlowUtils.UnknownCurrencyEppException;
@@ -686,8 +687,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
// This exception is referred to by its fully qualified path (rather than being imported) so
// that it is not included in the list of exceptions thrown by DomainRestoreRequestFlow, as this
// test EPP won't trigger the request flow at all.
EppException thrown = assertThrows(
google.registry.flows.EppException.UnimplementedCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedCommandException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("domain restore reports are not supported");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.monitoring.metrics.MetricRegistry;
import com.google.monitoring.metrics.MetricRegistryImpl;
import com.google.monitoring.metrics.VirtualMetric;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import org.junit.jupiter.api.BeforeEach;
@@ -57,7 +58,7 @@ class JvmMetricsTests {
assertThat(registry.getRegisteredMetrics()).hasSize(3);
for (var metric : registry.getRegisteredMetrics()) {
assertThat(metric).isInstanceOf(com.google.monitoring.metrics.VirtualMetric.class);
assertThat(metric).isInstanceOf(VirtualMetric.class);
}
}
@@ -36,6 +36,7 @@ import google.registry.testing.FakeClock;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.stream.IntStream;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -161,7 +162,7 @@ public class MosApiMetricsTest {
@Test
void testRecordStates_partitionsTimeSeries_atLimit() throws IOException {
ImmutableList<TldServiceState> largeBatch =
java.util.stream.IntStream.range(0, 70)
IntStream.range(0, 70)
.mapToObj(i -> createTldState("tld-" + i, "UP", "UP"))
.collect(ImmutableList.toImmutableList());
mosApiMetrics.recordStates(largeBatch);
@@ -41,33 +41,32 @@ public class DatabaseExceptionTest {
@Test
void getSqlError_sqlExceptionNoDetails() {
assertThat(getSqlError(new java.sql.SQLException())).isEmpty();
assertThat(getSqlError(new SQLException())).isEmpty();
}
@Test
void getSqlError_sqlExceptionWithSqlState() {
assertThat(getSqlError(new java.sql.SQLException("msg", "state")))
assertThat(getSqlError(new SQLException("msg", "state")))
.contains("\tSQL Error: 0, SQLState: state, message: msg.");
}
@Test
void getSqlError_sqlExceptionWithAllDetails() {
assertThat(getSqlError(new java.sql.SQLException("msg", "state", 1)))
assertThat(getSqlError(new SQLException("msg", "state", 1)))
.contains("\tSQL Error: 1, SQLState: state, message: msg.");
}
@Test
void getSqlError_chainedSqlExceptionWithAllDetails() {
SQLException sqlException = new java.sql.SQLException("msg", "state", 1);
SQLException sqlException = new SQLException("msg", "state", 1);
assertThat(getSqlError(new Exception("not-captured", sqlException)))
.contains("\tSQL Error: 1, SQLState: state, message: msg.");
}
@Test
void getSqlError_multipleChainedSqlExceptionWithAllDetails() {
SQLException lower = new java.sql.SQLException("lower", "lower-state", 1);
SQLException higher =
new java.sql.SQLException("higher", "higher-state", 2, new Exception(lower));
SQLException lower = new SQLException("lower", "lower-state", 1);
SQLException higher = new SQLException("higher", "higher-state", 2, new Exception(lower));
assertThat(getSqlError(new Exception(higher)))
.contains(
"\tSQL Error: 2, SQLState: higher-state, message: higher.\n"
@@ -382,8 +382,8 @@ class AuthenticatedRegistrarAccessorTest {
@Test
void testConsoleUser_admin() {
google.registry.model.console.User consoleUser =
new google.registry.model.console.User.Builder()
User consoleUser =
new User.Builder()
.setEmailAddress("email@email.com")
.setUserRoles(
new UserRoles.Builder().setIsAdmin(true).setGlobalRole(GlobalRole.FTE).build())
@@ -408,8 +408,8 @@ class AuthenticatedRegistrarAccessorTest {
void testConsoleUser_globalRole() {
// Users with global roles shouldn't necessarily have access to specific registrars if they're
// not admins
google.registry.model.console.User consoleUser =
new google.registry.model.console.User.Builder()
User consoleUser =
new User.Builder()
.setEmailAddress("email@email.com")
.setUserRoles(new UserRoles.Builder().setGlobalRole(GlobalRole.SUPPORT_AGENT).build())
.build();
@@ -425,8 +425,8 @@ class AuthenticatedRegistrarAccessorTest {
@Test
void testConsoleUser_registrarRoles() {
// Registrar employees should have OWNER access to their registrars
google.registry.model.console.User consoleUser =
new google.registry.model.console.User.Builder()
User consoleUser =
new User.Builder()
.setEmailAddress("email@email.com")
.setUserRoles(
new UserRoles.Builder()
@@ -136,9 +136,7 @@ public final class DomainSubject extends AbstractEppResourceSubject<Domain, Doma
}
public And<DomainSubject> hasNoAutorenewEndTime() {
return hasNoValue(
actual.getAutorenewEndTime().map(google.registry.util.DateTimeUtils::toInstant),
"getAutorenewEndTime()");
return hasNoValue(actual.getAutorenewEndTimeInstant(), "getAutorenewEndTime()");
}
public static SimpleSubjectBuilder<DomainSubject, Domain> assertAboutDomains() {