mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 02:36:03 +02:00
Resolve some Guava 20 TODOs (mostly unnecessary asList() calls)
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=146799536
This commit is contained in:
parent
f212a53232
commit
ec55aa5361
12 changed files with 18 additions and 41 deletions
|
@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
|
|||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static google.registry.xml.XmlTestUtils.assertXmlEquals;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -33,6 +32,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
import google.registry.flows.EppTestComponent.FakesAndMocksModule;
|
||||
import google.registry.flows.picker.FlowPicker;
|
||||
|
@ -268,7 +268,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
}};
|
||||
// Ordering is irrelevant but duplicates should be considered independently.
|
||||
assertThat(FluentIterable.from(pollMessages).transform(idStripper))
|
||||
.containsExactlyElementsIn(FluentIterable.from(asList(expected)).transform(idStripper));
|
||||
.containsExactlyElementsIn(FluentIterable.from(expected).transform(idStripper));
|
||||
}
|
||||
|
||||
private EppOutput runFlowInternal(CommitMode commitMode, UserPrivileges userPrivileges)
|
||||
|
@ -318,10 +318,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths)
|
||||
throws Exception {
|
||||
// Always ignore the server trid, since it's generated and meaningless to flow correctness.
|
||||
// TODO(user): Remove asList()
|
||||
String[] ignoredPathsPlusTrid = FluentIterable.from(asList(ignoredPaths))
|
||||
.append("epp.response.trID.svTRID")
|
||||
.toArray(String.class);
|
||||
String[] ignoredPathsPlusTrid = ObjectArrays.concat(ignoredPaths, "epp.response.trID.svTRID");
|
||||
EppOutput output = runFlowInternal(commitMode, userPrivileges);
|
||||
if (output.isResponse()) {
|
||||
assertThat(output.isSuccess()).isTrue();
|
||||
|
|
|
@ -29,7 +29,6 @@ import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
|||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -177,7 +176,7 @@ public class DomainTransferApproveFlowTest
|
|||
.build();
|
||||
assertBillingEventsForResource(
|
||||
domain,
|
||||
FluentIterable.from(asList(expectedCancellationBillingEvents))
|
||||
FluentIterable.from(expectedCancellationBillingEvents)
|
||||
.transform(new Function<BillingEvent.Cancellation.Builder, BillingEvent>() {
|
||||
@Override
|
||||
public Cancellation apply(Builder builder) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import static google.registry.testing.GenericEppResourceSubject.assertAboutEppRe
|
|||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.joda.money.CurrencyUnit.EUR;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
|
@ -212,7 +211,7 @@ public class DomainTransferRequestFlowTest
|
|||
.setPeriodYears(registrationYears)
|
||||
.setParent(historyEntryTransferRequest)
|
||||
.build();
|
||||
assertBillingEvents(FluentIterable.from(asList(extraExpectedBillingEvents))
|
||||
assertBillingEvents(FluentIterable.from(extraExpectedBillingEvents)
|
||||
.transform(new Function<BillingEvent.Cancellation.Builder, BillingEvent>() {
|
||||
@Override
|
||||
public BillingEvent apply(Builder builder) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
|||
import static google.registry.util.DomainNameUtils.ACE_PREFIX_REGEX;
|
||||
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
|
@ -626,7 +625,7 @@ public class DatastoreHelper {
|
|||
public static void assertBillingEvents(BillingEvent... expected) throws Exception {
|
||||
assertThat(FluentIterable.from(getBillingEvents()).transform(BILLING_EVENT_ID_STRIPPER))
|
||||
.containsExactlyElementsIn(
|
||||
FluentIterable.from(asList(expected)).transform(BILLING_EVENT_ID_STRIPPER));
|
||||
FluentIterable.from(expected).transform(BILLING_EVENT_ID_STRIPPER));
|
||||
}
|
||||
|
||||
/** Assert that the expected billing events set is exactly the one found in the fake datastore. */
|
||||
|
@ -643,7 +642,7 @@ public class DatastoreHelper {
|
|||
EppResource resource, BillingEvent... expected) throws Exception {
|
||||
assertThat(FluentIterable.from(getBillingEvents(resource)).transform(BILLING_EVENT_ID_STRIPPER))
|
||||
.containsExactlyElementsIn(
|
||||
FluentIterable.from(asList(expected)).transform(BILLING_EVENT_ID_STRIPPER));
|
||||
FluentIterable.from(expected).transform(BILLING_EVENT_ID_STRIPPER));
|
||||
}
|
||||
|
||||
/** Assert that there are no billing events. */
|
||||
|
@ -664,7 +663,7 @@ public class DatastoreHelper {
|
|||
throws Exception {
|
||||
assertThat(FluentIterable.from(getPollMessages(resource)).transform(POLL_MESSAGE_ID_STRIPPER))
|
||||
.containsExactlyElementsIn(
|
||||
FluentIterable.from(asList(expected)).transform(POLL_MESSAGE_ID_STRIPPER));
|
||||
FluentIterable.from(expected).transform(POLL_MESSAGE_ID_STRIPPER));
|
||||
}
|
||||
|
||||
/** Helper to effectively erase the poll message ID to facilitate comparison. */
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.collect.Iterables.toArray;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
@ -21,7 +22,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||
import com.beust.jcommander.JCommander;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
@ -114,7 +114,7 @@ public abstract class CommandTestCase<C extends Command> {
|
|||
|
||||
/** Writes the data to a temporary file and then returns a path to the file. */
|
||||
String writeToNamedTmpFile(String filename, Iterable<String> data) throws IOException {
|
||||
return writeToNamedTmpFile(filename, FluentIterable.from(data).toArray(String.class));
|
||||
return writeToNamedTmpFile(filename, toArray(data, String.class));
|
||||
}
|
||||
|
||||
/** Writes the data to a temporary file and then returns a path to the file. */
|
||||
|
@ -129,7 +129,7 @@ public abstract class CommandTestCase<C extends Command> {
|
|||
|
||||
/** Writes the data to a temporary file and then returns a path to the file. */
|
||||
String writeToTmpFile(Iterable<String> data) throws IOException {
|
||||
return writeToNamedTmpFile("tmp_file", FluentIterable.from(data).toArray(String.class));
|
||||
return writeToNamedTmpFile("tmp_file", toArray(data, String.class));
|
||||
}
|
||||
|
||||
/** Returns a path to a known good certificate file. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue