diff --git a/java/google/registry/model/ofy/AugmentedDeleter.java b/java/google/registry/model/ofy/AugmentedDeleter.java index d53a756b1..8c6f19efa 100644 --- a/java/google/registry/model/ofy/AugmentedDeleter.java +++ b/java/google/registry/model/ofy/AugmentedDeleter.java @@ -65,7 +65,7 @@ abstract class AugmentedDeleter implements Deleter { // homogeneous iterables of a fixed Key type, e.g. List>, and is convenient for // callers) into the type Iterable> (a concrete type of heterogeneous keys, which is // convenient for users). - handleDeletion(ImmutableList.>copyOf(keys)); + handleDeletion(ImmutableList.copyOf(keys)); return delegate.keys(keys); } diff --git a/javatests/google/registry/backup/RestoreCommitLogsActionTest.java b/javatests/google/registry/backup/RestoreCommitLogsActionTest.java index 9baa4deeb..acf91e035 100644 --- a/javatests/google/registry/backup/RestoreCommitLogsActionTest.java +++ b/javatests/google/registry/backup/RestoreCommitLogsActionTest.java @@ -112,13 +112,13 @@ public class RestoreCommitLogsActionTest { CommitLogManifest.create( getBucketKey(1), now.minusMinutes(3), - ImmutableSet.>of(Key.create(TestObject.create("previous to delete")))), + ImmutableSet.of(Key.create(TestObject.create("previous to delete")))), CommitLogMutation.create(manifest1aKey, TestObject.create("a")), CommitLogMutation.create(manifest1aKey, TestObject.create("b")), CommitLogManifest.create( getBucketKey(2), now.minusMinutes(2), - ImmutableSet.>of(Key.create(TestObject.create("a")))), + ImmutableSet.of(Key.create(TestObject.create("a")))), CommitLogMutation.create(manifest1bKey, TestObject.create("c")), CommitLogMutation.create(manifest1bKey, TestObject.create("d"))); Iterable file2CommitLogs = saveDiffFile( @@ -126,7 +126,7 @@ public class RestoreCommitLogsActionTest { CommitLogManifest.create( getBucketKey(1), now.minusMinutes(1), - ImmutableSet.>of(Key.create(TestObject.create("c")))), + ImmutableSet.of(Key.create(TestObject.create("c")))), CommitLogMutation.create(manifest2Key, TestObject.create("e")), CommitLogMutation.create(manifest2Key, TestObject.create("f"))); action.fromTime = now.minusMinutes(1).minusMillis(1); @@ -150,7 +150,7 @@ public class RestoreCommitLogsActionTest { assertExpectedIds("previous to keep"); assertInDatastore(commitLogs); assertInDatastore(asList(CommitLogCheckpointRoot.create(now))); - assertCommitLogBuckets(ImmutableMap.of()); + assertCommitLogBuckets(ImmutableMap.of()); } @Test @@ -183,7 +183,7 @@ public class RestoreCommitLogsActionTest { CommitLogManifest.create( getBucketKey(1), now, - ImmutableSet.>of(Key.create(TestObject.create("previous to delete"))))); + ImmutableSet.of(Key.create(TestObject.create("previous to delete"))))); action.run(); ofy().clearSessionCache(); assertExpectedIds("previous to keep"); @@ -236,7 +236,7 @@ public class RestoreCommitLogsActionTest { CommitLogManifest.create( getBucketKey(1), now, - ImmutableSet.>of(Key.create(TestObject.create("previous to delete"))))); + ImmutableSet.of(Key.create(TestObject.create("previous to delete"))))); action.run(); ofy().clearSessionCache(); assertExpectedIds("previous to keep"); @@ -252,7 +252,7 @@ public class RestoreCommitLogsActionTest { private Iterable saveDiffFile( CommitLogCheckpoint checkpoint, ImmutableObject... entities) throws IOException { DateTime now = checkpoint.getCheckpointTime(); - List allEntities = Lists.asList(checkpoint, entities); + List allEntities = Lists.asList(checkpoint, entities); ByteArrayOutputStream output = new ByteArrayOutputStream(); for (ImmutableObject entity : allEntities) { serializeEntity(entity, output); diff --git a/javatests/google/registry/export/CheckSnapshotActionTest.java b/javatests/google/registry/export/CheckSnapshotActionTest.java index de0c4b9fe..dae76994b 100644 --- a/javatests/google/registry/export/CheckSnapshotActionTest.java +++ b/javatests/google/registry/export/CheckSnapshotActionTest.java @@ -86,7 +86,7 @@ public class CheckSnapshotActionTest { new DatastoreBackupInfo( backupInfo.getName(), backupInfo.getStartTime(), - Optional.empty(), + Optional.empty(), backupInfo.getKinds(), backupInfo.getGcsFilename()); diff --git a/javatests/google/registry/export/ExportReservedTermsActionTest.java b/javatests/google/registry/export/ExportReservedTermsActionTest.java index 5c4db7010..51e438b00 100644 --- a/javatests/google/registry/export/ExportReservedTermsActionTest.java +++ b/javatests/google/registry/export/ExportReservedTermsActionTest.java @@ -96,10 +96,12 @@ public class ExportReservedTermsActionTest { @Test public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() throws Exception { - persistResource(Registry.get("tld").asBuilder() - .setReservedLists(ImmutableSet.of()) - .setDriveFolderId(null) - .build()); + persistResource( + Registry.get("tld") + .asBuilder() + .setReservedLists(ImmutableSet.of()) + .setDriveFolderId(null) + .build()); runAction("tld"); verify(response).setStatus(SC_OK); verify(response).setPayload("No reserved lists configured"); diff --git a/javatests/google/registry/export/SyncGroupMembersActionTest.java b/javatests/google/registry/export/SyncGroupMembersActionTest.java index a0f3c6c1c..0455c33e8 100644 --- a/javatests/google/registry/export/SyncGroupMembersActionTest.java +++ b/javatests/google/registry/export/SyncGroupMembersActionTest.java @@ -154,11 +154,11 @@ public class SyncGroupMembersActionTest { when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example")) .thenReturn(ImmutableSet.of("defunct@example.com", "janedoe@theregistrar.com")); when(connection.getMembersOfGroup("newregistrar-marketing-contacts@domain-registry.example")) - .thenReturn(ImmutableSet. of()); + .thenReturn(ImmutableSet.of()); when(connection.getMembersOfGroup("theregistrar-technical-contacts@domain-registry.example")) - .thenReturn(ImmutableSet. of()); + .thenReturn(ImmutableSet.of()); when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example")) - .thenReturn(ImmutableSet. of()); + .thenReturn(ImmutableSet.of()); persistResource( new RegistrarContact.Builder() .setParent(loadRegistrar("NewRegistrar")) @@ -200,7 +200,7 @@ public class SyncGroupMembersActionTest { @Test public void test_doPost_gracefullyHandlesExceptionForSingleRegistrar() throws Exception { when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example")) - .thenReturn(ImmutableSet. of()); + .thenReturn(ImmutableSet.of()); when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example")) .thenThrow(new IOException("Internet was deleted")); runAction(); diff --git a/javatests/google/registry/flows/EppControllerTest.java b/javatests/google/registry/flows/EppControllerTest.java index 9b1f70d9c..77e343eda 100644 --- a/javatests/google/registry/flows/EppControllerTest.java +++ b/javatests/google/registry/flows/EppControllerTest.java @@ -101,8 +101,7 @@ public class EppControllerTest extends ShardableTestCase { loggerToIntercept.addHandler(logHandler); when(sessionMetadata.getClientId()).thenReturn("some-client"); - when(flowComponentBuilder.flowModule(Matchers.any())) - .thenReturn(flowComponentBuilder); + when(flowComponentBuilder.flowModule(Matchers.any())).thenReturn(flowComponentBuilder); when(flowComponentBuilder.build()).thenReturn(flowComponent); when(flowComponent.flowRunner()).thenReturn(flowRunner); when(eppOutput.isResponse()).thenReturn(true); diff --git a/javatests/google/registry/flows/EppLifecycleContactTest.java b/javatests/google/registry/flows/EppLifecycleContactTest.java index 73f801e44..eb741b90a 100644 --- a/javatests/google/registry/flows/EppLifecycleContactTest.java +++ b/javatests/google/registry/flows/EppLifecycleContactTest.java @@ -86,7 +86,7 @@ public class EppLifecycleContactTest extends EppTestCase { assertCommandAndResponse("login_valid.xml", "login_response.xml"); assertCommandAndResponse( "contact_create_sh8013.xml", - ImmutableMap.of(), + ImmutableMap.of(), "contact_create_response_sh8013.xml", ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"), DateTime.parse("2000-06-01T00:00:00Z")); diff --git a/javatests/google/registry/flows/EppLifecycleDomainApplicationTest.java b/javatests/google/registry/flows/EppLifecycleDomainApplicationTest.java index d227d4cc2..916e9df94 100644 --- a/javatests/google/registry/flows/EppLifecycleDomainApplicationTest.java +++ b/javatests/google/registry/flows/EppLifecycleDomainApplicationTest.java @@ -52,7 +52,7 @@ public class EppLifecycleDomainApplicationTest extends EppTestCase { DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z"); assertCommandAndResponse( "contact_create_sh8013.xml", - ImmutableMap.of(), + ImmutableMap.of(), "contact_create_response_sh8013.xml", ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"), startTime); diff --git a/javatests/google/registry/flows/EppLifecycleDomainTest.java b/javatests/google/registry/flows/EppLifecycleDomainTest.java index c5085f77a..8167e8d0f 100644 --- a/javatests/google/registry/flows/EppLifecycleDomainTest.java +++ b/javatests/google/registry/flows/EppLifecycleDomainTest.java @@ -53,7 +53,7 @@ public class EppLifecycleDomainTest extends EppTestCase { DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z"); assertCommandAndResponse( "contact_create_sh8013.xml", - ImmutableMap.of(), + ImmutableMap.of(), "contact_create_response_sh8013.xml", ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"), startTime); diff --git a/javatests/google/registry/flows/EppLifecycleHostTest.java b/javatests/google/registry/flows/EppLifecycleHostTest.java index 0a7218ecf..0331268d9 100644 --- a/javatests/google/registry/flows/EppLifecycleHostTest.java +++ b/javatests/google/registry/flows/EppLifecycleHostTest.java @@ -49,7 +49,7 @@ public class EppLifecycleHostTest extends EppTestCase { assertCommandAndResponse("login_valid.xml", "login_response.xml"); assertCommandAndResponse( "hello.xml", - ImmutableMap.of(), + ImmutableMap.of(), "greeting.xml", ImmutableMap.of("DATE", "2000-06-02T00:00:00Z"), DateTime.parse("2000-06-02T00:00:00Z")); @@ -78,7 +78,7 @@ public class EppLifecycleHostTest extends EppTestCase { "host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"), "host_info_response.xml", - ImmutableMap.of( + ImmutableMap.of( "HOSTNAME", "ns1.example.tld", "ROID", "1-ROID", "CRDATE", "2000-06-02T00:01:00Z"), DateTime.parse("2000-06-02T00:02:00Z")); assertThat(getRecordedEppMetric()) @@ -93,7 +93,7 @@ public class EppLifecycleHostTest extends EppTestCase { "host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"), "generic_success_action_pending_response.xml", - ImmutableMap.of(), + ImmutableMap.of(), DateTime.parse("2000-06-02T00:03:00Z")); assertThat(getRecordedEppMetric()) .hasClientId("NewRegistrar") @@ -113,7 +113,7 @@ public class EppLifecycleHostTest extends EppTestCase { // Create the fakesite domain. assertCommandAndResponse( "contact_create_sh8013.xml", - ImmutableMap.of(), + ImmutableMap.of(), "contact_create_response_sh8013.xml", ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"), DateTime.parse("2000-06-01T00:00:00Z")); @@ -164,7 +164,7 @@ public class EppLifecycleHostTest extends EppTestCase { assertCommandAndResponse( "contact_create_sh8013.xml", - ImmutableMap.of(), + ImmutableMap.of(), "contact_create_response_sh8013.xml", ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"), DateTime.parse("2000-06-01T00:00:00Z")); diff --git a/javatests/google/registry/flows/FlowReporterTest.java b/javatests/google/registry/flows/FlowReporterTest.java index 8ba46f4bc..de66441f7 100644 --- a/javatests/google/registry/flows/FlowReporterTest.java +++ b/javatests/google/registry/flows/FlowReporterTest.java @@ -137,7 +137,7 @@ public class FlowReporterTest extends ShardableTestCase { @Test public void testRecordToLogs_metadata_notResourceFlow_noResourceTypeOrTld() throws Exception { when(flowReporter.eppInput.isDomainResourceType()).thenReturn(false); - when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.empty()); + when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.empty()); flowReporter.recordToLogs(); Map json = parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-METADATA: ")); @@ -177,7 +177,7 @@ public class FlowReporterTest extends ShardableTestCase { @Test public void testRecordToLogs_metadata_multipleTargetIds_uniqueTldSet() throws Exception { when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true); - when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.empty()); + when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.empty()); when(flowReporter.eppInput.getTargetIds()) .thenReturn(ImmutableList.of("target.co.uk", "foo.uk", "bar.uk", "baz.com")); flowReporter.recordToLogs(); diff --git a/javatests/google/registry/flows/FlowRunnerTest.java b/javatests/google/registry/flows/FlowRunnerTest.java index bd20d72ca..bef481d24 100644 --- a/javatests/google/registry/flows/FlowRunnerTest.java +++ b/javatests/google/registry/flows/FlowRunnerTest.java @@ -79,7 +79,7 @@ public class FlowRunnerTest extends ShardableTestCase { flowRunner.isSuperuser = false; flowRunner.isTransactional = false; flowRunner.sessionMetadata = - new StatelessRequestSessionMetadata("TheRegistrar", ImmutableSet.of()); + new StatelessRequestSessionMetadata("TheRegistrar", ImmutableSet.of()); flowRunner.trid = Trid.create("client-123", "server-456"); flowRunner.flowReporter = Mockito.mock(FlowReporter.class); } diff --git a/javatests/google/registry/flows/FlowTestCase.java b/javatests/google/registry/flows/FlowTestCase.java index d2b1ba4f2..f9f27f99e 100644 --- a/javatests/google/registry/flows/FlowTestCase.java +++ b/javatests/google/registry/flows/FlowTestCase.java @@ -116,7 +116,7 @@ public abstract class FlowTestCase extends ShardableTestCase { } protected void setEppInput(String inputFilename) { - eppLoader = new EppLoader(this, inputFilename, ImmutableMap.of()); + eppLoader = new EppLoader(this, inputFilename, ImmutableMap.of()); } protected void setEppInput(String inputFilename, Map substitutions) { diff --git a/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java b/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java index 26870c0eb..a5e4752ce 100644 --- a/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java +++ b/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java @@ -158,7 +158,7 @@ public class ChildEntityInputTest { setupSecondDomainResources(); Set seen = new HashSet<>(); InputReader reader = EppResourceInputs.createChildEntityInput( - ImmutableSet.>of(EppResource.class), + ImmutableSet.of(EppResource.class), ImmutableSet.>of( HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class)) .createReaders().get(0); @@ -188,16 +188,14 @@ public class ChildEntityInputTest { @Test public void testSuccess_childEntityInput_polymorphicBaseType() throws Exception { - createChildEntityInput( - ImmutableSet.>of(EppResource.class), - ImmutableSet.>of(BillingEvent.class)); + createChildEntityInput(ImmutableSet.of(EppResource.class), ImmutableSet.of(BillingEvent.class)); } @Test public void testSuccess_childEntityReader_multipleChildTypes() throws Exception { setupResources(); InputReader reader = EppResourceInputs.createChildEntityInput( - ImmutableSet.>of(EppResource.class), + ImmutableSet.of(EppResource.class), ImmutableSet.>of( HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class)) .createReaders().get(0); @@ -235,7 +233,7 @@ public class ChildEntityInputTest { public void testSuccess_childEntityReader_polymorphicChildFiltering() throws Exception { setupResources(); InputReader reader = EppResourceInputs.createChildEntityInput( - ImmutableSet.>of(EppResource.class), + ImmutableSet.of(EppResource.class), ImmutableSet.>of(BillingEvent.OneTime.class)) .createReaders().get(0); assertThat(getAllFromReader(reader)).containsExactly(oneTimeA); @@ -245,7 +243,7 @@ public class ChildEntityInputTest { public void testSuccess_childEntityReader_polymorphicChildClass() throws Exception { setupResources(); InputReader reader = EppResourceInputs.createChildEntityInput( - ImmutableSet.>of(EppResource.class), + ImmutableSet.of(EppResource.class), ImmutableSet.>of(BillingEvent.class)) .createReaders().get(0); assertThat(getAllFromReader(reader)).containsExactly(oneTimeA, recurringA); @@ -303,11 +301,13 @@ public class ChildEntityInputTest { public void testSuccess_childEntityReader_survivesAcrossSerialization() throws Exception { setupResources(); Set seen = new HashSet<>(); - InputReader reader = EppResourceInputs.createChildEntityInput( - ImmutableSet.>of(EppResource.class), - ImmutableSet.>of( - HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class)) - .createReaders().get(0); + InputReader reader = + EppResourceInputs.createChildEntityInput( + ImmutableSet.of(EppResource.class), + ImmutableSet.>of( + HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class)) + .createReaders() + .get(0); reader.beginShard(); reader.beginSlice(); seen.add(reader.next()); diff --git a/javatests/google/registry/model/ImmutableObjectTest.java b/javatests/google/registry/model/ImmutableObjectTest.java index 66dc03477..bee23f3a2 100644 --- a/javatests/google/registry/model/ImmutableObjectTest.java +++ b/javatests/google/registry/model/ImmutableObjectTest.java @@ -269,7 +269,7 @@ public class ImmutableObjectTest { assertThat((List) diffableFieldMap.get("array")).containsExactly((Object) null); assertThat((List) diffableFieldMap.get("list")).containsExactly((Object) null); assertThat((Set) diffableFieldMap.get("set")).containsExactly((Object) null); - assertThat((Map) diffableFieldMap.get("map")).containsExactly("a", (Object) null); + assertThat((Map) diffableFieldMap.get("map")).containsExactly("a", null); } /** Subclass of ImmutableObject with keys to other objects. */ diff --git a/javatests/google/registry/model/ModelUtilsTest.java b/javatests/google/registry/model/ModelUtilsTest.java index 75be7d22f..fb96c4c22 100644 --- a/javatests/google/registry/model/ModelUtilsTest.java +++ b/javatests/google/registry/model/ModelUtilsTest.java @@ -86,7 +86,7 @@ public class ModelUtilsTest { @Test public void testGetAllFields() throws Exception { - Map expected = ImmutableMap.of( + Map expected = ImmutableMap.of( "id", TestClass.class.getDeclaredField("id"), "a", TestClass.class.getDeclaredField("a"), "b", TestClass.class.getDeclaredField("b")); diff --git a/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java b/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java index 65d277908..3ffc04362 100644 --- a/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java +++ b/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java @@ -124,7 +124,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { @Test public void testSuccess_balanceMap_getActiveBalance_emptyMap() throws Exception { - BalanceMap map = new BalanceMap(ImmutableMap.>of()); + BalanceMap map = new BalanceMap(ImmutableMap.of()); assertThat(map.getActiveBalanceAtTime(START_OF_TIME)).isEmpty(); assertThat(map.getActiveBalanceAtTime(clock.nowUtc())).isEmpty(); assertThat(map.getActiveBalanceAtTime(END_OF_TIME)).isEmpty(); diff --git a/javatests/google/registry/model/common/TimeOfYearTest.java b/javatests/google/registry/model/common/TimeOfYearTest.java index f4d5c4686..88f3f7b38 100644 --- a/javatests/google/registry/model/common/TimeOfYearTest.java +++ b/javatests/google/registry/model/common/TimeOfYearTest.java @@ -63,7 +63,7 @@ public class TimeOfYearTest { DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z"); DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z"); TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z")); - ImmutableSet expected = ImmutableSet.of( + ImmutableSet expected = ImmutableSet.of( DateTime.parse("2012-05-01T00:00:00Z"), DateTime.parse("2013-05-01T00:00:00Z"), DateTime.parse("2014-05-01T00:00:00Z"), @@ -78,7 +78,7 @@ public class TimeOfYearTest { DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z"); DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z"); TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z")); - ImmutableSet expected = ImmutableSet.of( + ImmutableSet expected = ImmutableSet.of( DateTime.parse("2013-05-01T00:00:00Z"), DateTime.parse("2014-05-01T00:00:00Z"), DateTime.parse("2015-05-01T00:00:00Z"), @@ -92,7 +92,7 @@ public class TimeOfYearTest { DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z"); DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z"); TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z")); - ImmutableSet expected = ImmutableSet.of( + ImmutableSet expected = ImmutableSet.of( DateTime.parse("2012-05-01T00:00:00Z"), DateTime.parse("2013-05-01T00:00:00Z"), DateTime.parse("2014-05-01T00:00:00Z"), @@ -106,7 +106,7 @@ public class TimeOfYearTest { DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z"); DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z"); TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z")); - ImmutableSet expected = ImmutableSet.of( + ImmutableSet expected = ImmutableSet.of( DateTime.parse("2013-05-01T00:00:00Z"), DateTime.parse("2014-05-01T00:00:00Z"), DateTime.parse("2015-05-01T00:00:00Z")); @@ -117,10 +117,8 @@ public class TimeOfYearTest { @Test public void testSuccess_getInstancesInRange_normalizedLowerBound() { TimeOfYear timeOfYear = TimeOfYear.fromDateTime(START_OF_TIME); - ImmutableSet expected = ImmutableSet.of( - START_OF_TIME, - START_OF_TIME.plusYears(1), - START_OF_TIME.plusYears(2)); + ImmutableSet expected = + ImmutableSet.of(START_OF_TIME, START_OF_TIME.plusYears(1), START_OF_TIME.plusYears(2)); assertThat(timeOfYear.getInstancesInRange(Range.atMost(START_OF_TIME.plusYears(2)))) .containsExactlyElementsIn(expected); } @@ -128,10 +126,8 @@ public class TimeOfYearTest { @Test public void testSuccess_getInstancesInRange_normalizedUpperBound() { TimeOfYear timeOfYear = TimeOfYear.fromDateTime(END_OF_TIME); - ImmutableSet expected = ImmutableSet.of( - END_OF_TIME.minusYears(2), - END_OF_TIME.minusYears(1), - END_OF_TIME); + ImmutableSet expected = + ImmutableSet.of(END_OF_TIME.minusYears(2), END_OF_TIME.minusYears(1), END_OF_TIME); assertThat(timeOfYear.getInstancesInRange(Range.atLeast(END_OF_TIME.minusYears(2)))) .containsExactlyElementsIn(expected); } diff --git a/javatests/google/registry/model/common/TimedTransitionPropertyTest.java b/javatests/google/registry/model/common/TimedTransitionPropertyTest.java index 57bbc18a4..b5e995ed3 100644 --- a/javatests/google/registry/model/common/TimedTransitionPropertyTest.java +++ b/javatests/google/registry/model/common/TimedTransitionPropertyTest.java @@ -148,7 +148,7 @@ public class TimedTransitionPropertyTest { IllegalArgumentException.class, () -> TimedTransitionProperty.fromValueMap( - ImmutableSortedMap.of(), StringTimedTransition.class)); + ImmutableSortedMap.of(), StringTimedTransition.class)); } @Test diff --git a/javatests/google/registry/model/contact/ContactResourceTest.java b/javatests/google/registry/model/contact/ContactResourceTest.java index 7c8c48c01..b2b64d4fc 100644 --- a/javatests/google/registry/model/contact/ContactResourceTest.java +++ b/javatests/google/registry/model/contact/ContactResourceTest.java @@ -35,7 +35,6 @@ import google.registry.model.eppcommon.PresenceMarker; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.transfer.TransferData; -import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferStatus; import org.junit.Before; import org.junit.Test; @@ -101,8 +100,7 @@ public class ContactResourceTest extends EntityTestCase { .setLosingClientId("losing") .setPendingTransferExpirationTime(clock.nowUtc()) .setServerApproveEntities( - ImmutableSet.>of( - Key.create(BillingEvent.OneTime.class, 1))) + ImmutableSet.of(Key.create(BillingEvent.OneTime.class, 1))) .setTransferRequestTime(clock.nowUtc()) .setTransferStatus(TransferStatus.SERVER_APPROVED) .setTransferRequestTrid(Trid.create("client-trid", "server-trid")) diff --git a/javatests/google/registry/model/domain/DomainApplicationTest.java b/javatests/google/registry/model/domain/DomainApplicationTest.java index fbd52388a..12abfa6ce 100644 --- a/javatests/google/registry/model/domain/DomainApplicationTest.java +++ b/javatests/google/registry/model/domain/DomainApplicationTest.java @@ -37,7 +37,6 @@ import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; -import google.registry.model.host.HostResource; import google.registry.model.smd.EncodedSignedMark; import org.joda.money.Money; import org.junit.Before; @@ -123,16 +122,13 @@ public class DomainApplicationTest extends EntityTestCase { @Test public void testEmptySetsAndArraysBecomeNull() { assertThat(emptyBuilder().setNameservers(null).build().nsHosts).isNull(); - assertThat(emptyBuilder() - .setNameservers(ImmutableSet.>of()) - .build() - .nsHosts) - .isNull(); - assertThat(emptyBuilder() - .setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld")))) - .build() - .nsHosts) - .isNotNull(); + assertThat(emptyBuilder().setNameservers(ImmutableSet.of()).build().nsHosts).isNull(); + assertThat( + emptyBuilder() + .setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld")))) + .build() + .nsHosts) + .isNotNull(); // This behavior should also hold true for ImmutableObjects nested in collections. assertThat(emptyBuilder() .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, null))) diff --git a/javatests/google/registry/model/domain/DomainResourceTest.java b/javatests/google/registry/model/domain/DomainResourceTest.java index 26701eb46..6de137efd 100644 --- a/javatests/google/registry/model/domain/DomainResourceTest.java +++ b/javatests/google/registry/model/domain/DomainResourceTest.java @@ -50,7 +50,6 @@ import google.registry.model.poll.PollMessage; import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferData; -import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferStatus; import java.util.stream.Stream; import org.joda.money.Money; @@ -124,10 +123,7 @@ public class DomainResourceTest extends EntityTestCase { .setLosingClientId("losing") .setPendingTransferExpirationTime(clock.nowUtc()) .setServerApproveEntities( - ImmutableSet.>of( - oneTimeBillKey, - recurringBillKey, - autorenewPollKey)) + ImmutableSet.of(oneTimeBillKey, recurringBillKey, autorenewPollKey)) .setServerApproveBillingEvent(oneTimeBillKey) .setServerApproveAutorenewEvent(recurringBillKey) .setServerApproveAutorenewPollMessage(autorenewPollKey) @@ -186,11 +182,15 @@ public class DomainResourceTest extends EntityTestCase { @Test public void testEmptySetsAndArraysBecomeNull() { - assertThat(newDomainResource("example.com").asBuilder() - .setNameservers(null).build().nsHosts).isNull(); - assertThat(newDomainResource("example.com").asBuilder() - .setNameservers(ImmutableSet.>of()).build().nsHosts) - .isNull(); + assertThat(newDomainResource("example.com").asBuilder().setNameservers(null).build().nsHosts) + .isNull(); + assertThat( + newDomainResource("example.com") + .asBuilder() + .setNameservers(ImmutableSet.of()) + .build() + .nsHosts) + .isNull(); assertThat(newDomainResource("example.com").asBuilder() .setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld")))) .build().nsHosts) @@ -292,22 +292,27 @@ public class DomainResourceTest extends EntityTestCase { .setPeriodYears(1) .setParent(historyEntry) .build()); - domain = domain.asBuilder() - .setRegistrationExpirationTime(oldExpirationTime) - .setTransferData(domain.getTransferData().asBuilder() - .setTransferStatus(TransferStatus.PENDING) - .setTransferRequestTime(clock.nowUtc().minusDays(4)) - .setPendingTransferExpirationTime(clock.nowUtc().plusDays(1)) - .setGainingClientId("winner") - .setServerApproveBillingEvent(Key.create(transferBillingEvent)) - .setServerApproveEntities(ImmutableSet.>of( - Key.create(transferBillingEvent))) - .build()) - .addGracePeriod( - // Okay for billing event to be null since the point of this grace period is just - // to check that the transfer will clear all existing grace periods. - GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(100), "foo", null)) - .build(); + domain = + domain + .asBuilder() + .setRegistrationExpirationTime(oldExpirationTime) + .setTransferData( + domain + .getTransferData() + .asBuilder() + .setTransferStatus(TransferStatus.PENDING) + .setTransferRequestTime(clock.nowUtc().minusDays(4)) + .setPendingTransferExpirationTime(clock.nowUtc().plusDays(1)) + .setGainingClientId("winner") + .setServerApproveBillingEvent(Key.create(transferBillingEvent)) + .setServerApproveEntities(ImmutableSet.of(Key.create(transferBillingEvent))) + .build()) + .addGracePeriod( + // Okay for billing event to be null since the point of this grace period is just + // to check that the transfer will clear all existing grace periods. + GracePeriod.create( + GracePeriodStatus.ADD, clock.nowUtc().plusDays(100), "foo", null)) + .build(); DomainResource afterTransfer = domain.cloneProjectedAtTime(clock.nowUtc().plusDays(1)); DateTime newExpirationTime = oldExpirationTime.plusYears(1); Key serverApproveAutorenewEvent = diff --git a/javatests/google/registry/model/host/HostResourceTest.java b/javatests/google/registry/model/host/HostResourceTest.java index 6ddf02ba7..6de71aa1f 100644 --- a/javatests/google/registry/model/host/HostResourceTest.java +++ b/javatests/google/registry/model/host/HostResourceTest.java @@ -32,9 +32,7 @@ import google.registry.model.domain.DomainResource; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.transfer.TransferData; -import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferStatus; -import java.net.InetAddress; import org.joda.time.DateTime; import org.junit.Before; import org.junit.Test; @@ -52,21 +50,23 @@ public class HostResourceTest extends EntityTestCase { public void setUp() throws Exception { createTld("com"); // Set up a new persisted registrar entity. - domain = persistResource( - newDomainResource("example.com").asBuilder() - .setRepoId("1-COM") - .setTransferData(new TransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") - .setPendingTransferExpirationTime(clock.nowUtc()) - .setServerApproveEntities( - ImmutableSet.>of( - Key.create(BillingEvent.OneTime.class, 1))) - .setTransferRequestTime(clock.nowUtc()) - .setTransferStatus(TransferStatus.SERVER_APPROVED) - .setTransferRequestTrid(Trid.create("client-trid", "server-trid")) - .build()) - .build()); + domain = + persistResource( + newDomainResource("example.com") + .asBuilder() + .setRepoId("1-COM") + .setTransferData( + new TransferData.Builder() + .setGainingClientId("gaining") + .setLosingClientId("losing") + .setPendingTransferExpirationTime(clock.nowUtc()) + .setServerApproveEntities( + ImmutableSet.of(Key.create(BillingEvent.OneTime.class, 1))) + .setTransferRequestTime(clock.nowUtc()) + .setTransferStatus(TransferStatus.SERVER_APPROVED) + .setTransferRequestTrid(Trid.create("client-trid", "server-trid")) + .build()) + .build()); host = persistResource( cloneAndSetAutoTimestamps( @@ -119,9 +119,8 @@ public class HostResourceTest extends EntityTestCase { @Test public void testEmptySetsBecomeNull() throws Exception { assertThat(new HostResource.Builder().setInetAddresses(null).build().inetAddresses).isNull(); - assertThat(new HostResource.Builder() - .setInetAddresses(ImmutableSet.of()).build().inetAddresses) - .isNull(); + assertThat(new HostResource.Builder().setInetAddresses(ImmutableSet.of()).build().inetAddresses) + .isNull(); assertThat( new HostResource.Builder() .setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1"))) diff --git a/javatests/google/registry/model/index/DomainApplicationIndexTest.java b/javatests/google/registry/model/index/DomainApplicationIndexTest.java index 96f46deee..95613d073 100644 --- a/javatests/google/registry/model/index/DomainApplicationIndexTest.java +++ b/javatests/google/registry/model/index/DomainApplicationIndexTest.java @@ -56,7 +56,7 @@ public class DomainApplicationIndexTest extends EntityTestCase { IllegalArgumentException thrown = expectThrows( IllegalArgumentException.class, - () -> createWithSpecifiedKeys("blah.com", ImmutableSet.>of())); + () -> createWithSpecifiedKeys("blah.com", ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty."); } diff --git a/javatests/google/registry/model/ofy/OfyCommitLogTest.java b/javatests/google/registry/model/ofy/OfyCommitLogTest.java index 261794935..5e05b64de 100644 --- a/javatests/google/registry/model/ofy/OfyCommitLogTest.java +++ b/javatests/google/registry/model/ofy/OfyCommitLogTest.java @@ -159,7 +159,7 @@ public class OfyCommitLogTest { @Test public void testTransactNew_deleteNotBackedUpKind_throws() throws Exception { final CommitLogManifest backupsArentAllowedOnMe = - CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.>of()); + CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = expectThrows( IllegalArgumentException.class, @@ -170,7 +170,7 @@ public class OfyCommitLogTest { @Test public void testTransactNew_saveNotBackedUpKind_throws() throws Exception { final CommitLogManifest backupsArentAllowedOnMe = - CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.>of()); + CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = expectThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/model/registry/RegistryTest.java b/javatests/google/registry/model/registry/RegistryTest.java index ba0ee59fd..b37dd02d3 100644 --- a/javatests/google/registry/model/registry/RegistryTest.java +++ b/javatests/google/registry/model/registry/RegistryTest.java @@ -143,7 +143,7 @@ public class RegistryTest extends EntityTestCase { .asBuilder().setReservedLists(ImmutableSet.of(rl5, rl6)).build(); assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList())) .containsExactly("tld-reserved5", "tld-reserved6"); - r = Registry.get("tld").asBuilder().setReservedLists(ImmutableSet. of()).build(); + r = Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of()).build(); assertThat(r.getReservedLists()).isEmpty(); } @@ -164,7 +164,7 @@ public class RegistryTest extends EntityTestCase { .build(); assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList())) .containsExactly("tld-reserved24", "tld-reserved25"); - r = Registry.get("tld").asBuilder().setReservedListsByName(ImmutableSet. of()).build(); + r = Registry.get("tld").asBuilder().setReservedListsByName(ImmutableSet.of()).build(); assertThat(r.getReservedLists()).isEmpty(); } diff --git a/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java b/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java index 513565896..d00751155 100644 --- a/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java +++ b/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java @@ -62,8 +62,7 @@ public class SignedMarkRevocationListTest { public void testEmpty() throws Exception { // When Datastore is empty, it should give us an empty thing. assertThat(SignedMarkRevocationList.get()) - .isEqualTo(SignedMarkRevocationList.create( - START_OF_TIME, ImmutableMap.of())); + .isEqualTo(SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of())); } @Test @@ -114,7 +113,7 @@ public class SignedMarkRevocationListTest { assertThrows( NullPointerException.class, () -> - SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of()) + SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of()) .isSmdRevoked(null, clock.nowUtc())); } diff --git a/javatests/google/registry/model/transfer/TransferDataTest.java b/javatests/google/registry/model/transfer/TransferDataTest.java index a7ef433f6..b3eb27ae8 100644 --- a/javatests/google/registry/model/transfer/TransferDataTest.java +++ b/javatests/google/registry/model/transfer/TransferDataTest.java @@ -23,7 +23,6 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; import google.registry.model.poll.PollMessage; -import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.testing.AppEngineRule; import org.joda.time.DateTime; import org.junit.Before; @@ -74,7 +73,7 @@ public class TransferDataTest { .setPendingTransferExpirationTime(now) .setTransferStatus(TransferStatus.PENDING) .setServerApproveEntities( - ImmutableSet.>of( + ImmutableSet.of( transferBillingEventKey, otherServerApproveBillingEventKey, recurringBillingEventKey, diff --git a/javatests/google/registry/model/translators/StatusValueAdapterTest.java b/javatests/google/registry/model/translators/StatusValueAdapterTest.java index 1ea042ac1..598655ad9 100644 --- a/javatests/google/registry/model/translators/StatusValueAdapterTest.java +++ b/javatests/google/registry/model/translators/StatusValueAdapterTest.java @@ -31,7 +31,6 @@ import google.registry.model.host.HostInfoData; import google.registry.testing.AppEngineRule; import google.registry.testing.EppLoader; import google.registry.xml.ValidationMode; -import java.net.InetAddress; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -58,7 +57,7 @@ public class StatusValueAdapterTest { .setCreationTime(START_OF_TIME) .setCurrentSponsorClientId("") .setFullyQualifiedHostName("") - .setInetAddresses(ImmutableSet.of()) + .setInetAddresses(ImmutableSet.of()) .setRepoId("") .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .build()) diff --git a/javatests/google/registry/monitoring/metrics/CustomFitterTest.java b/javatests/google/registry/monitoring/metrics/CustomFitterTest.java index d85d1645f..25fcb9dd8 100644 --- a/javatests/google/registry/monitoring/metrics/CustomFitterTest.java +++ b/javatests/google/registry/monitoring/metrics/CustomFitterTest.java @@ -26,11 +26,11 @@ import org.junit.runners.JUnit4; /** Tests for {@link CustomFitter}. */ @RunWith(JUnit4.class) public class CustomFitterTest { + @Test public void testCreateCustomFitter_emptyBounds_throwsException() throws Exception { IllegalArgumentException thrown = - expectThrows( - IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.of())); + expectThrows(IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("boundaries must not be empty"); } @@ -45,7 +45,6 @@ public class CustomFitterTest { @Test public void testCreateCustomFitter_hasGivenBounds() { CustomFitter fitter = CustomFitter.create(ImmutableSortedSet.of(1.0, 2.0)); - assertThat(fitter.boundaries()).containsExactly(1.0, 2.0).inOrder(); } } diff --git a/javatests/google/registry/monitoring/metrics/MetricReporterTest.java b/javatests/google/registry/monitoring/metrics/MetricReporterTest.java index d72e0ebcd..dfb7dd359 100644 --- a/javatests/google/registry/monitoring/metrics/MetricReporterTest.java +++ b/javatests/google/registry/monitoring/metrics/MetricReporterTest.java @@ -43,20 +43,19 @@ public class MetricReporterTest { @Test public void testRunOneIteration_enqueuesBatch() throws Exception { - Metric metric = - new Counter("/name", "description", "vdn", ImmutableSet.of()); + Metric metric = new Counter("/name", "description", "vdn", ImmutableSet.of()); when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of(metric, metric)); MetricReporter reporter = new MetricReporter(writer, 10L, threadFactory, registry, writeQueue); reporter.runOneIteration(); - verify(writeQueue).offer(Optional.of(ImmutableList.>of())); + verify(writeQueue).offer(Optional.of(ImmutableList.of())); } @Test public void testShutDown_enqueuesBatchAndPoisonPill() throws Exception { // Set up a registry with no metrics. - when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.>of()); + when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of()); MetricReporter reporter = spy(new MetricReporter(writer, 10L, threadFactory, registry, writeQueue)); @@ -64,7 +63,7 @@ public class MetricReporterTest { verify(reporter).runOneIteration(); InOrder interactions = Mockito.inOrder(writeQueue); - interactions.verify(writeQueue).offer(Optional.of(ImmutableList.>of())); - interactions.verify(writeQueue).offer(Optional.>>empty()); + interactions.verify(writeQueue).offer(Optional.of(ImmutableList.of())); + interactions.verify(writeQueue).offer(Optional.empty()); } } diff --git a/javatests/google/registry/monitoring/metrics/MetricSchemaTest.java b/javatests/google/registry/monitoring/metrics/MetricSchemaTest.java index ea4a689a1..34d293604 100644 --- a/javatests/google/registry/monitoring/metrics/MetricSchemaTest.java +++ b/javatests/google/registry/monitoring/metrics/MetricSchemaTest.java @@ -38,7 +38,7 @@ public class MetricSchemaTest { "description", "valueDisplayName", Kind.GAUGE, - ImmutableSet.of())); + ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Name must not be blank"); } @@ -49,11 +49,7 @@ public class MetricSchemaTest { IllegalArgumentException.class, () -> MetricSchema.create( - "/name", - "", - "valueDisplayName", - Kind.GAUGE, - ImmutableSet.of())); + "/name", "", "valueDisplayName", Kind.GAUGE, ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Description must not be blank"); } @@ -62,9 +58,7 @@ public class MetricSchemaTest { IllegalArgumentException thrown = expectThrows( IllegalArgumentException.class, - () -> - MetricSchema.create( - "/name", "description", "", Kind.GAUGE, ImmutableSet.of())); + () -> MetricSchema.create("/name", "description", "", Kind.GAUGE, ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Value Display Name must not be empty"); } @@ -75,11 +69,7 @@ public class MetricSchemaTest { IllegalArgumentException.class, () -> MetricSchema.create( - "foo", - "description", - "valueDisplayName", - Kind.GAUGE, - ImmutableSet.of())); + "foo", "description", "valueDisplayName", Kind.GAUGE, ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Name must be URL-like and start with a '/'"); } } diff --git a/javatests/google/registry/monitoring/metrics/StoredMetricTest.java b/javatests/google/registry/monitoring/metrics/StoredMetricTest.java index 7732f085b..6718d3a7a 100644 --- a/javatests/google/registry/monitoring/metrics/StoredMetricTest.java +++ b/javatests/google/registry/monitoring/metrics/StoredMetricTest.java @@ -31,8 +31,7 @@ public class StoredMetricTest { @Test public void testGetCardinality_reflectsCurrentCardinality() { StoredMetric smallMetric = - new StoredMetric<>( - "/metric", "description", "vdn", ImmutableSet.of(), Boolean.class); + new StoredMetric<>("/metric", "description", "vdn", ImmutableSet.of(), Boolean.class); assertThat(smallMetric.getCardinality()).isEqualTo(0); smallMetric.set(true); diff --git a/javatests/google/registry/monitoring/metrics/example/SheepCounterExample.java b/javatests/google/registry/monitoring/metrics/example/SheepCounterExample.java index be33d10bd..58cfd56df 100644 --- a/javatests/google/registry/monitoring/metrics/example/SheepCounterExample.java +++ b/javatests/google/registry/monitoring/metrics/example/SheepCounterExample.java @@ -113,7 +113,7 @@ public final class SheepCounterExample { "/is_sleeping", "Tracks sleep state.", "Sleeping?", - ImmutableSet.of(), + ImmutableSet.of(), Boolean.class); /** @@ -128,8 +128,8 @@ public final class SheepCounterExample { "/sleep_quality", "Quality of the sleep.", "Quality", - ImmutableSet.of(), - () -> ImmutableMap.of(ImmutableList.of(), new Random().nextDouble()), + ImmutableSet.of(), + () -> ImmutableMap.of(ImmutableList.of(), new Random().nextDouble()), Double.class); /** diff --git a/javatests/google/registry/monitoring/whitebox/EppMetricTest.java b/javatests/google/registry/monitoring/whitebox/EppMetricTest.java index 2f9b6cd6c..34778d286 100644 --- a/javatests/google/registry/monitoring/whitebox/EppMetricTest.java +++ b/javatests/google/registry/monitoring/whitebox/EppMetricTest.java @@ -70,7 +70,7 @@ public class EppMetricTest { public void test_zeroTlds_areRecordedAsAbsent() throws Exception { EppMetric metric = EppMetric.builderForRequest("request-id-1", new FakeClock()) - .setTlds(ImmutableSet.of()) + .setTlds(ImmutableSet.of()) .build(); assertThat(metric.getTld()).isEmpty(); } diff --git a/javatests/google/registry/monitoring/whitebox/MetricsExportActionTest.java b/javatests/google/registry/monitoring/whitebox/MetricsExportActionTest.java index 85bbcd9c0..9d12d2159 100644 --- a/javatests/google/registry/monitoring/whitebox/MetricsExportActionTest.java +++ b/javatests/google/registry/monitoring/whitebox/MetricsExportActionTest.java @@ -104,7 +104,7 @@ public class MetricsExportActionTest { @Test public void testSuccess_emptyErrors() throws Exception { when(insertAll.execute()).thenReturn(response); - response.setInsertErrors(ImmutableList.of()); + response.setInsertErrors(ImmutableList.of()); action.run(); verify(insertAll).execute(); } diff --git a/javatests/google/registry/request/RequestHandlerTest.java b/javatests/google/registry/request/RequestHandlerTest.java index 10642510e..c2b3133e8 100644 --- a/javatests/google/registry/request/RequestHandlerTest.java +++ b/javatests/google/registry/request/RequestHandlerTest.java @@ -211,7 +211,7 @@ public final class RequestHandlerTest { @Before public void before() throws Exception { // Initialize here, not inline, so that we pick up the mocked UserService. - handler = RequestHandler.createForTest( + handler = RequestHandler.createForTest( Component.class, Providers.of(new Builder() { @Override @@ -421,7 +421,7 @@ public final class RequestHandlerTest { when(req.getMethod()).thenReturn("GET"); when(req.getRequestURI()).thenReturn("/auth/adminUser"); when(requestAuthenticator.authorize(AUTH_INTERNAL_OR_ADMIN.authSettings(), req)) - .thenReturn(Optional.empty()); + .thenReturn(Optional.empty()); handler.handleRequest(req, rsp); diff --git a/javatests/google/registry/request/auth/RequestAuthenticatorTest.java b/javatests/google/registry/request/auth/RequestAuthenticatorTest.java index f9a50b9a6..1a437f0e6 100644 --- a/javatests/google/registry/request/auth/RequestAuthenticatorTest.java +++ b/javatests/google/registry/request/auth/RequestAuthenticatorTest.java @@ -74,7 +74,7 @@ public class RequestAuthenticatorTest { UserPolicy.ADMIN); private static final AuthSettings AUTH_NO_METHODS = AuthSettings.create( - ImmutableList.of(), + ImmutableList.of(), AuthLevel.APP, UserPolicy.IGNORED); @@ -120,7 +120,7 @@ public class RequestAuthenticatorTest { private RequestAuthenticator createRequestAuthenticator(UserService userService) { return new RequestAuthenticator( new AppEngineInternalAuthenticationMechanism(), - ImmutableList.of( + ImmutableList.of( new OAuthAuthenticationMechanism( fakeOAuthService, ImmutableSet.of("test-scope1", "test-scope2", "test-scope3"), diff --git a/javatests/google/registry/storage/drive/DriveConnectionTest.java b/javatests/google/registry/storage/drive/DriveConnectionTest.java index 353e0cdce..09c88155f 100644 --- a/javatests/google/registry/storage/drive/DriveConnectionTest.java +++ b/javatests/google/registry/storage/drive/DriveConnectionTest.java @@ -170,9 +170,7 @@ public class DriveConnectionTest { .setParents(ImmutableList.of(new ParentReference().setId("driveFolderId")))), argThat(hasByteArrayContent(DATA)))) .thenReturn(insert); - ChildList emptyChildList = new ChildList() - .setItems(ImmutableList. of()) - .setNextPageToken(null); + ChildList emptyChildList = new ChildList().setItems(ImmutableList.of()).setNextPageToken(null); when(childrenList.execute()).thenReturn(emptyChildList); assertThat(driveConnection.createOrUpdateFile( "title", diff --git a/javatests/google/registry/testing/DatastoreHelper.java b/javatests/google/registry/testing/DatastoreHelper.java index d125da02c..81cde7d83 100644 --- a/javatests/google/registry/testing/DatastoreHelper.java +++ b/javatests/google/registry/testing/DatastoreHelper.java @@ -95,7 +95,6 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.smd.EncodedSignedMark; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData.Builder; -import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferStatus; import google.registry.tmch.LordnTask; import java.util.Arrays; @@ -513,7 +512,7 @@ public class DatastoreHelper { .setTransferData(createTransferDataBuilder(requestTime, expirationTime) .setPendingTransferExpirationTime(now.plus(getContactAutomaticTransferLength())) .setServerApproveEntities( - ImmutableSet.>of( + ImmutableSet.of( // Pretend it's 3 days since the request Key.create(persistResource( createPollMessageForImplicitTransfer( @@ -600,7 +599,7 @@ public class DatastoreHelper { .setServerApproveBillingEvent(Key.create(transferBillingEvent)) .setServerApproveAutorenewEvent(Key.create(gainingClientAutorenewEvent)) .setServerApproveAutorenewPollMessage(Key.create(gainingClientAutorenewPollMessage)) - .setServerApproveEntities(ImmutableSet.>of( + .setServerApproveEntities(ImmutableSet.of( Key.create(transferBillingEvent), Key.create(gainingClientAutorenewEvent), Key.create(gainingClientAutorenewPollMessage), @@ -646,14 +645,14 @@ public class DatastoreHelper { } private static Iterable getBillingEvents() { - return Iterables.concat( + return Iterables.concat( ofy().load().type(BillingEvent.OneTime.class), ofy().load().type(BillingEvent.Recurring.class), ofy().load().type(BillingEvent.Cancellation.class)); } private static Iterable getBillingEvents(EppResource resource) { - return Iterables.concat( + return Iterables.concat( ofy().load().type(BillingEvent.OneTime.class).ancestor(resource), ofy().load().type(BillingEvent.Recurring.class).ancestor(resource), ofy().load().type(BillingEvent.Cancellation.class).ancestor(resource)); diff --git a/javatests/google/registry/testing/EppLoader.java b/javatests/google/registry/testing/EppLoader.java index 8f6b3a07d..0dd9e8811 100644 --- a/javatests/google/registry/testing/EppLoader.java +++ b/javatests/google/registry/testing/EppLoader.java @@ -29,7 +29,7 @@ public class EppLoader { private String eppXml; public EppLoader(Object context, String eppXmlFilename) { - this(context, eppXmlFilename, ImmutableMap.of()); + this(context, eppXmlFilename, ImmutableMap.of()); } public EppLoader(Object context, String eppXmlFilename, Map substitutions) { diff --git a/javatests/google/registry/testing/FakeOAuthService.java b/javatests/google/registry/testing/FakeOAuthService.java index 7d93303bf..f9a0426c2 100644 --- a/javatests/google/registry/testing/FakeOAuthService.java +++ b/javatests/google/registry/testing/FakeOAuthService.java @@ -59,7 +59,7 @@ public class FakeOAuthService implements OAuthService { } public void setAuthorizedScopes(String... scopes) { - this.authorizedScopes = ImmutableList.copyOf(scopes); + this.authorizedScopes = ImmutableList.copyOf(scopes); } @Override diff --git a/javatests/google/registry/testing/FakeURLFetchService.java b/javatests/google/registry/testing/FakeURLFetchService.java index 6f47414f2..cfd144523 100644 --- a/javatests/google/registry/testing/FakeURLFetchService.java +++ b/javatests/google/registry/testing/FakeURLFetchService.java @@ -14,7 +14,6 @@ package google.registry.testing; -import com.google.appengine.api.urlfetch.HTTPHeader; import com.google.appengine.api.urlfetch.HTTPRequest; import com.google.appengine.api.urlfetch.HTTPResponse; import com.google.appengine.api.urlfetch.URLFetchService; @@ -42,8 +41,7 @@ public class FakeURLFetchService extends ForwardingURLFetchService { if (backingMap.containsKey(requestURL)) { return backingMap.get(requestURL); } else { - return new HTTPResponse( - HttpURLConnection.HTTP_NOT_FOUND, null, null, ImmutableList.of()); + return new HTTPResponse(HttpURLConnection.HTTP_NOT_FOUND, null, null, ImmutableList.of()); } } } diff --git a/javatests/google/registry/testing/LogsSubject.java b/javatests/google/registry/testing/LogsSubject.java index 8b8211776..8e74f1ecc 100644 --- a/javatests/google/registry/testing/LogsSubject.java +++ b/javatests/google/registry/testing/LogsSubject.java @@ -51,7 +51,7 @@ public class LogsSubject extends Subject { }; private List getMessagesAtLevel(Level level) { - ImmutableList.Builder builder = ImmutableList.builder(); + ImmutableList.Builder builder = new ImmutableList.Builder<>(); for (LogRecord log : actual().getStoredLogRecords()) { if (log.getLevel().equals(level)) { builder.add(log.getMessage()); diff --git a/javatests/google/registry/testing/TaskQueueHelper.java b/javatests/google/registry/testing/TaskQueueHelper.java index 52386008c..d58a0abd8 100644 --- a/javatests/google/registry/testing/TaskQueueHelper.java +++ b/javatests/google/registry/testing/TaskQueueHelper.java @@ -213,7 +213,7 @@ public class TaskQueueHelper { public static void assertTasksEnqueued(String queueName, Iterable taskStateInfos) throws Exception { - ImmutableList.Builder taskMatchers = ImmutableList.builder(); + ImmutableList.Builder taskMatchers = new ImmutableList.Builder<>(); for (TaskStateInfo taskStateInfo : taskStateInfos) { taskMatchers.add(new TaskMatcher(taskStateInfo)); } diff --git a/javatests/google/registry/testing/mapreduce/MapreduceTestCase.java b/javatests/google/registry/testing/mapreduce/MapreduceTestCase.java index 3fddf83d5..2748bd8c5 100644 --- a/javatests/google/registry/testing/mapreduce/MapreduceTestCase.java +++ b/javatests/google/registry/testing/mapreduce/MapreduceTestCase.java @@ -88,8 +88,7 @@ public abstract class MapreduceTestCase extends ShardableTestCase { } protected MapreduceRunner makeDefaultRunner() { - return new MapreduceRunner( - Optional.of(getEppResourceIndexBucketCount()), Optional.of(1)); + return new MapreduceRunner(Optional.of(getEppResourceIndexBucketCount()), Optional.of(1)); } protected List getTasks(String queueName) { @@ -178,7 +177,7 @@ public abstract class MapreduceTestCase extends ShardableTestCase { */ protected void executeTasksUntilEmpty(String queueName, @Nullable FakeClock clock) throws Exception { - executeTasks(queueName, clock, Optional.empty()); + executeTasks(queueName, clock, Optional.empty()); } /** diff --git a/javatests/google/registry/tldconfig/idn/IdnTableTest.java b/javatests/google/registry/tldconfig/idn/IdnTableTest.java index 251fb8105..d1350c09d 100644 --- a/javatests/google/registry/tldconfig/idn/IdnTableTest.java +++ b/javatests/google/registry/tldconfig/idn/IdnTableTest.java @@ -29,7 +29,7 @@ import org.junit.runners.JUnit4; public class IdnTableTest { @Test public void testDigits() { - ImmutableList of = ImmutableList.of( + ImmutableList of = ImmutableList.of( "# URL: https://love.example/lolcatattack.txt", "# Policy: https://love.example/policy.html", "U+0030", @@ -42,8 +42,7 @@ public class IdnTableTest { "U+0037", "U+0038", "U+0039"); - IdnTable idnTable = - IdnTable.createFrom("lolcatattack", of, Optional.empty()); + IdnTable idnTable = IdnTable.createFrom("lolcatattack", of, Optional.empty()); assertThat(idnTable.isValidLabel("0123456789")).isTrue(); assertThat(idnTable.isValidLabel("54321a")).isFalse(); assertThat(idnTable.isValidLabel("AAA000")).isFalse(); @@ -51,7 +50,7 @@ public class IdnTableTest { @Test public void testIgnoreCommentAndEmptyLines() { - IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.of( + IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.of( "# URL: https://love.example/lolcatattack.txt", "# Policy: https://love.example/policy.html", "U+0030", @@ -65,21 +64,25 @@ public class IdnTableTest { "U+0036", "U+0037", "U+0038", - "U+0039"), Optional.empty()); + "U+0039"), Optional.empty()); assertThat(idnTable.isValidLabel("0123456789")).isFalse(); assertThat(idnTable.isValidLabel("023456789")).isTrue(); // Works when you remove 1 } @Test public void testSurrogates() { - IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.of( - "# URL: https://love.example/lolcatattack.txt", - "# Policy: https://love.example/policy.html", - "U+0035", - "U+0036", - "U+0037", - "U+2070E", - "U+20731"), Optional.empty()); + IdnTable idnTable = + IdnTable.createFrom( + "lolcatattack", + ImmutableList.of( + "# URL: https://love.example/lolcatattack.txt", + "# Policy: https://love.example/policy.html", + "U+0035", + "U+0036", + "U+0037", + "U+2070E", + "U+20731"), + Optional.empty()); assertThat(idnTable.getName()).isEqualTo("lolcatattack"); assertThat(idnTable.isValidLabel("𠜎")).isTrue(); assertThat(idnTable.isValidLabel("𠜱")).isTrue(); @@ -90,34 +93,31 @@ public class IdnTableTest { @Test public void testSpecialComments_getParsed() { - ImmutableList of = ImmutableList.of( - "# URL: https://love.example/lolcatattack.txt", - "# Policy: https://love.example/policy.html"); + ImmutableList of = + ImmutableList.of( + "# URL: https://love.example/lolcatattack.txt", + "# Policy: https://love.example/policy.html"); IdnTable idnTable = - IdnTable.createFrom("lolcatattack", of, Optional.empty()); + IdnTable.createFrom("lolcatattack", of, Optional.empty()); assertThat(idnTable.getUrl()).isEqualTo(URI.create("https://love.example/lolcatattack.txt")); assertThat(idnTable.getPolicy()).isEqualTo(URI.create("https://love.example/policy.html")); } @Test public void testMissingUrl_throwsNpe() { - ImmutableList of = ImmutableList.of( - "# Policy: https://love.example/policy.html"); + ImmutableList of = ImmutableList.of("# Policy: https://love.example/policy.html"); NullPointerException thrown = expectThrows( - NullPointerException.class, - () -> IdnTable.createFrom("sloth", of, Optional.empty())); + NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty())); assertThat(thrown).hasMessageThat().contains("sloth missing '# URL:"); } @Test public void testMissingPolicy_throwsNpe() { - ImmutableList of = ImmutableList.of( - "# URL: https://love.example/sloth.txt"); + ImmutableList of = ImmutableList.of("# URL: https://love.example/sloth.txt"); NullPointerException thrown = expectThrows( - NullPointerException.class, - () -> IdnTable.createFrom("sloth", of, Optional.empty())); + NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty())); assertThat(thrown).hasMessageThat().contains("sloth missing '# Policy:"); } } diff --git a/javatests/google/registry/tools/CreateLrpTokensCommandTest.java b/javatests/google/registry/tools/CreateLrpTokensCommandTest.java index fab6e6a90..12e87ff74 100644 --- a/javatests/google/registry/tools/CreateLrpTokensCommandTest.java +++ b/javatests/google/registry/tools/CreateLrpTokensCommandTest.java @@ -78,7 +78,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase>any()); + .saveTokens(Mockito.any()); runCommand("--assignee=domain.tld", "--tlds=tld"); assertLrpTokens( createToken("LRP_abcdefghijklmnop", "domain.tld", ImmutableSet.of("tld"), null, null)); diff --git a/javatests/google/registry/tools/EppToolVerifier.java b/javatests/google/registry/tools/EppToolVerifier.java index 96e153aa2..31e12e690 100644 --- a/javatests/google/registry/tools/EppToolVerifier.java +++ b/javatests/google/registry/tools/EppToolVerifier.java @@ -168,7 +168,7 @@ public class EppToolVerifier { ArgumentCaptor params = ArgumentCaptor.forClass(byte[].class); verify(connection, atLeast(0)).send( eq("/_dr/epptool"), - eq(ImmutableMap.of()), + eq(ImmutableMap.of()), eq(MediaType.FORM_DATA), params.capture()); capturedParams = ImmutableList.copyOf(params.getAllValues()); diff --git a/javatests/google/registry/tools/ListObjectsCommandTestCase.java b/javatests/google/registry/tools/ListObjectsCommandTestCase.java index 0848b1390..6b662d23d 100644 --- a/javatests/google/registry/tools/ListObjectsCommandTestCase.java +++ b/javatests/google/registry/tools/ListObjectsCommandTestCase.java @@ -52,7 +52,7 @@ public abstract class ListObjectsCommandTestCase * The TLD to be used (for those subclasses that use TLDs; defaults to empty). */ protected List getTlds() { - return ImmutableList.of(); + return ImmutableList.of(); } /** @@ -101,7 +101,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand(tldsParameter); } - verifySent(null, Optional.empty(), Optional.empty()); + verifySent(null, Optional.empty(), Optional.empty()); } @Test @@ -111,7 +111,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand("--fields=fieldName", tldsParameter); } - verifySent("fieldName", Optional.empty(), Optional.empty()); + verifySent("fieldName", Optional.empty(), Optional.empty()); } @Test @@ -121,7 +121,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand("--fields=*", tldsParameter); } - verifySent("*", Optional.empty(), Optional.empty()); + verifySent("*", Optional.empty(), Optional.empty()); } @Test @@ -131,7 +131,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand("--fields=fieldName", "--header=true", tldsParameter); } - verifySent("fieldName", Optional.of(Boolean.TRUE), Optional.empty()); + verifySent("fieldName", Optional.of(Boolean.TRUE), Optional.empty()); } @Test @@ -141,7 +141,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand("--fields=fieldName", "--header=false", tldsParameter); } - verifySent("fieldName", Optional.of(Boolean.FALSE), Optional.empty()); + verifySent("fieldName", Optional.of(Boolean.FALSE), Optional.empty()); } @Test @@ -151,7 +151,7 @@ public abstract class ListObjectsCommandTestCase } else { runCommand("--fields=fieldName", "--full_field_names", tldsParameter); } - verifySent("fieldName", Optional.empty(), Optional.of(Boolean.TRUE)); + verifySent("fieldName", Optional.empty(), Optional.of(Boolean.TRUE)); } @Test diff --git a/javatests/google/registry/tools/PublishDetailReportCommandTest.java b/javatests/google/registry/tools/PublishDetailReportCommandTest.java index f057b82a8..8585f92ff 100644 --- a/javatests/google/registry/tools/PublishDetailReportCommandTest.java +++ b/javatests/google/registry/tools/PublishDetailReportCommandTest.java @@ -36,7 +36,7 @@ public class PublishDetailReportCommandTest extends CommandTestCaseof("driveId", "some123id")); + .thenReturn(ImmutableMap.of("driveId", "some123id")); } @Test diff --git a/javatests/google/registry/tools/VerifyOteCommandTest.java b/javatests/google/registry/tools/VerifyOteCommandTest.java index 0f4cd4584..0fafe7f64 100644 --- a/javatests/google/registry/tools/VerifyOteCommandTest.java +++ b/javatests/google/registry/tools/VerifyOteCommandTest.java @@ -41,10 +41,9 @@ public class VerifyOteCommandTest extends CommandTestCase { public void init() throws Exception { command.setConnection(connection); ImmutableMap response = - ImmutableMap.of( - "blobio", "Num actions: 19 - Reqs passed: 19/19 - Overall: PASS"); + ImmutableMap.of("blobio", "Num actions: 19 - Reqs passed: 19/19 - Overall: PASS"); when(connection.sendJson(anyString(), anyMapOf(String.class, Object.class))) - .thenReturn(ImmutableMap.of("blobio", response)); + .thenReturn(ImmutableMap.of("blobio", response)); } @Test