Switch from Guava Optionals to Java 8 Optionals

This was a surprisingly involved change. Some of the difficulties included
java.util.Optional purposely not being Serializable (so I had to move a
few Optionals in mapreduce classes to @Nullable) and having to add the Truth
Java8 extension library for assertion support.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171863777
This commit is contained in:
mcilwain 2017-10-11 13:09:26 -07:00 committed by jianglai
parent 184b2b56ac
commit c0f8da0c6e
581 changed files with 1325 additions and 932 deletions

View file

@ -14,12 +14,13 @@ java_library(
"//java/google/registry/config",
"//java/google/registry/util",
"//javatests/google/registry/testing",
"//third_party/java/truth",
"@com_google_appengine_api_1_0_sdk",
"@com_google_code_findbugs_jsr305",
"@com_google_guava",
"@com_google_guava_testlib",
"@com_google_re2j",
"@com_google_truth",
"@com_google_truth_extensions_truth_java8_extension",
"@joda_time",
"@junit",
"@org_mockito_all",

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.CollectionUtils.nullToEmpty;
import static google.registry.util.CollectionUtils.partitionMap;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static org.junit.Assert.fail;
import com.google.common.base.Function;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static google.registry.util.DateTimeUtils.earliestOf;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.DiffUtils.prettyPrintEntityDeepDiff;
import static google.registry.util.DiffUtils.prettyPrintSetDiff;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
import google.registry.testing.ExceptionRule;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
import google.registry.testing.ExceptionRule;

View file

@ -16,6 +16,7 @@ package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.testing.SystemInfo.hasCommand;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assume.assumeTrue;

View file

@ -17,6 +17,7 @@ package google.registry.util;
import static com.google.common.io.BaseEncoding.base64;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.Truth8.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.testing.EqualsTester;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.testing.LogsSubject.assertAboutLogs;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.SerializeUtils.deserialize;
import static google.registry.util.SerializeUtils.serialize;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import google.registry.testing.ExceptionRule;
import org.junit.Rule;

View file

@ -16,6 +16,7 @@ package google.registry.util;
import static com.google.appengine.api.taskqueue.TaskOptions.Builder.withUrl;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static java.util.Arrays.asList;
import com.google.common.collect.ImmutableSet;

View file

@ -15,6 +15,7 @@
package google.registry.util;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import google.registry.testing.ExceptionRule;
import java.io.Serializable;

View file

@ -18,6 +18,7 @@ import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.net.MediaType.CSV_UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.util.UrlFetchUtils.setPayloadMultipart;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Matchers.any;