Run automatic Java 8 conversion over codebase

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
This commit is contained in:
mcilwain 2017-10-05 10:48:38 -07:00 committed by Ben McIlwain
parent 44df5da771
commit 5edb7935ed
190 changed files with 2312 additions and 3096 deletions

View file

@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -88,14 +87,7 @@ public class ContactResourceToXjcConverterTest {
// o One or more <status> elements that describe the status of the
// contact object.
assertThat(
FluentIterable
.from(bean.getStatuses())
.transform(new Function<XjcContactStatusType, XjcContactStatusValueType>() {
@Override
public XjcContactStatusValueType apply(XjcContactStatusType status) {
return status.getS();
}}))
assertThat(FluentIterable.from(bean.getStatuses()).transform(XjcContactStatusType::getS))
.containsExactly(
XjcContactStatusValueType.CLIENT_DELETE_PROHIBITED,
XjcContactStatusValueType.SERVER_UPDATE_PROHIBITED);

View file

@ -26,7 +26,6 @@ import static google.registry.xjc.rgp.XjcRgpStatusValueType.TRANSFER_PERIOD;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.joda.money.CurrencyUnit.USD;
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -59,7 +58,6 @@ import google.registry.model.transfer.TransferStatus;
import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.util.Idn;
import google.registry.xjc.domain.XjcDomainContactType;
import google.registry.xjc.domain.XjcDomainStatusType;
import google.registry.xjc.domain.XjcDomainStatusValueType;
import google.registry.xjc.rde.XjcRdeContentsType;
@ -69,7 +67,6 @@ import google.registry.xjc.rde.XjcRdeMenuType;
import google.registry.xjc.rdedomain.XjcRdeDomain;
import google.registry.xjc.rdedomain.XjcRdeDomainElement;
import google.registry.xjc.rgp.XjcRgpStatusType;
import google.registry.xjc.rgp.XjcRgpStatusValueType;
import google.registry.xjc.secdns.XjcSecdnsDsDataType;
import java.io.ByteArrayOutputStream;
import org.joda.money.Money;
@ -109,13 +106,11 @@ public class DomainResourceToXjcConverterTest {
assertThat(bean.getClID()).isEqualTo("GetTheeBack");
assertThat(FluentIterable
.from(bean.getContacts())
.transform(new Function<XjcDomainContactType, String>() {
@Override
public String apply(XjcDomainContactType input) {
return String.format("%s %s", input.getType().toString(), input.getValue());
}})).containsExactly("ADMIN 5372808-IRL", "TECH 5372808-TRL");
assertThat(
FluentIterable.from(bean.getContacts())
.transform(
input -> String.format("%s %s", input.getType().toString(), input.getValue())))
.containsExactly("ADMIN 5372808-IRL", "TECH 5372808-TRL");
assertThat(bean.getCrDate()).isEqualTo(DateTime.parse("1900-01-01T00:00:00Z"));
@ -150,13 +145,8 @@ public class DomainResourceToXjcConverterTest {
// "pendingDelete" sub-statuses, including "redemptionPeriod",
// "pendingRestore", and "pendingDelete", that a domain name can be
// in as a result of grace period processing as specified in [RFC3915].
assertThat(FluentIterable
.from(bean.getRgpStatuses())
.transform(new Function<XjcRgpStatusType, XjcRgpStatusValueType>() {
@Override
public XjcRgpStatusValueType apply(XjcRgpStatusType status) {
return status.getS();
}})).containsExactly(TRANSFER_PERIOD, RENEW_PERIOD);
assertThat(FluentIterable.from(bean.getRgpStatuses()).transform(XjcRgpStatusType::getS))
.containsExactly(TRANSFER_PERIOD, RENEW_PERIOD);
assertThat(bean.getSecDNS()).named("secdns").isNotNull();
assertThat(bean.getSecDNS().getDsDatas()).named("secdns dsdata").isNotNull();
@ -170,19 +160,12 @@ public class DomainResourceToXjcConverterTest {
assertThat(bean.getRoid()).isEqualTo("2-Q9JYB4C");
assertThat(
FluentIterable
.from(bean.getStatuses())
.transform(new Function<XjcDomainStatusType, XjcDomainStatusValueType>() {
@Override
public XjcDomainStatusValueType apply(XjcDomainStatusType status) {
return status.getS();
}})
).containsExactly(
XjcDomainStatusValueType.CLIENT_DELETE_PROHIBITED,
XjcDomainStatusValueType.CLIENT_RENEW_PROHIBITED,
XjcDomainStatusValueType.CLIENT_TRANSFER_PROHIBITED,
XjcDomainStatusValueType.SERVER_UPDATE_PROHIBITED);
assertThat(FluentIterable.from(bean.getStatuses()).transform(XjcDomainStatusType::getS))
.containsExactly(
XjcDomainStatusValueType.CLIENT_DELETE_PROHIBITED,
XjcDomainStatusValueType.CLIENT_RENEW_PROHIBITED,
XjcDomainStatusValueType.CLIENT_TRANSFER_PROHIBITED,
XjcDomainStatusValueType.SERVER_UPDATE_PROHIBITED);
assertThat(bean.getTrDate()).isEqualTo(DateTime.parse("1910-01-01T00:00:00Z"));

View file

@ -14,6 +14,7 @@
package google.registry.rde;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.common.Cursor.CursorType.BRDA;
import static google.registry.model.common.Cursor.CursorType.RDE_STAGING;
@ -39,9 +40,7 @@ import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
import com.google.appengine.tools.cloudstorage.ListItem;
import com.google.appengine.tools.cloudstorage.ListOptions;
import com.google.appengine.tools.cloudstorage.ListResult;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@ -782,15 +781,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
ListResult listResult =
gcsService.list("rde-bucket", new ListOptions.Builder().setPrefix("manual/test").build());
ImmutableSet<String> filenames =
FluentIterable.from(ImmutableList.copyOf(listResult))
.transform(
new Function<ListItem, String>() {
@Override
public String apply(ListItem listItem) {
return listItem.getName();
}
})
.toSet();
ImmutableList.copyOf(listResult).stream().map(ListItem::getName).collect(toImmutableSet());
for (String tld : tlds) {
assertThat(filenames)
.containsAllOf(

View file

@ -14,6 +14,7 @@
package google.registry.rde.imports;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld;
@ -28,10 +29,9 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Streams;
import com.google.common.io.ByteSource;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.VoidWork;
@ -375,16 +375,14 @@ public class RdeImportUtilsTest extends ShardableTestCase {
/** Confirms that an EppResourceIndex entity exists in Datastore for a given resource. */
private static <T extends EppResource> void assertEppResourceIndexEntityFor(final T resource) {
ImmutableList<EppResourceIndex> indices = FluentIterable
.from(ofy().load()
.type(EppResourceIndex.class)
.filter("kind", Key.getKind(resource.getClass())))
.filter(new Predicate<EppResourceIndex>() {
@Override
public boolean apply(EppResourceIndex index) {
return ofy().load().key(index.getKey()).now().equals(resource);
}})
.toList();
ImmutableList<EppResourceIndex> indices =
Streams.stream(
ofy()
.load()
.type(EppResourceIndex.class)
.filter("kind", Key.getKind(resource.getClass())))
.filter(index -> ofy().load().key(index.getKey()).now().equals(resource))
.collect(toImmutableList());
assertThat(indices).hasSize(1);
assertThat(indices.get(0).getBucket())
.isEqualTo(EppResourceIndexBucket.getBucketKey(Key.create(resource)));