Remove unnecessary generic type arguments

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175155365
This commit is contained in:
mcilwain 2017-11-09 07:33:40 -08:00 committed by jianglai
parent 8dcc2d6833
commit 2aa897e698
140 changed files with 355 additions and 465 deletions

View file

@ -18,7 +18,6 @@ import static com.google.common.collect.Iterables.getLast;
import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
@ -1092,10 +1091,7 @@ public class DomainApplicationCreateFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistContactsAndHosts();
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
@ -1148,10 +1144,7 @@ public class DomainApplicationCreateFlowTest
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistContactsAndHosts();
clock.advanceOneMilli();
runSuperuserFlow("domain_create_sunrise_encoded_signed_mark_response.xml");

View file

@ -15,7 +15,6 @@
package google.registry.flows.domain;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.EppResourceUtils.isLinked;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
@ -163,26 +162,18 @@ public class DomainApplicationDeleteFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
}
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml"));

View file

@ -17,7 +17,6 @@ package google.registry.flows.domain;
import static com.google.common.collect.Sets.union;
import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
import static google.registry.testing.DatastoreHelper.createTld;
@ -278,7 +277,7 @@ public class DomainApplicationUpdateFlowTest
"domain_update_sunrise_dsdata_rem_all.xml",
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
ImmutableSet.<DelegationSignerData>of());
ImmutableSet.of());
}
@Test
@ -576,23 +575,17 @@ public class DomainApplicationUpdateFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistApplication();
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
}
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistApplication();
clock.advanceOneMilli();

View file

@ -287,10 +287,7 @@ public class DomainCheckFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
}
@ -299,10 +296,7 @@ public class DomainCheckFlowTest
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistActiveDomain("example2.tld");
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_check_one_tld_response.xml"));
}
@ -415,7 +409,7 @@ public class DomainCheckFlowTest
*/
@Test
public void testAvailExtension_premiumDomainsAreUnavailableWithoutExtension() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
createTld("example");
setEppInput("domain_check_premium.xml");
doCheckTest(create(false, "rich.example", "Premium names require EPP ext."));
@ -427,7 +421,7 @@ public class DomainCheckFlowTest
*/
@Test
public void testAvailExtension_premiumDomainsAvailableIfNotRequiredByTld() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_check_premium.xml");

View file

@ -115,10 +115,7 @@ public class DomainClaimsCheckFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
}
@ -128,10 +125,7 @@ public class DomainClaimsCheckFlowTest
persistClaimsList(
ImmutableMap.of("example2", "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001"));
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
assertTransactionalFlow(false);
assertNoHistory(); // Checks don't create a history event.
assertNoBillingEvents(); // Checks are always free.
@ -161,9 +155,8 @@ public class DomainClaimsCheckFlowTest
public void testFailure_multipleTlds_oneHasEndedClaims() throws Exception {
createTld("tld1");
createTld("tld2");
persistResource(Registry.get("tld2").asBuilder()
.setClaimsPeriodEnd(clock.nowUtc().minusMillis(1))
.build());
persistResource(
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
setEppInput("domain_check_claims_multiple_tlds.xml");
thrown.expect(ClaimsPeriodEndedException.class);
runFlow();

View file

@ -201,7 +201,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
: clock.nowUtc().plus(Registry.get(domainTld).getAddGracePeriodLength());
ImmutableSet<BillingEvent.Flag> billingFlags = isAnchorTenant
? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT)
: ImmutableSet.<BillingEvent.Flag>of();
: ImmutableSet.of();
HistoryEntry historyEntry = getHistoryEntries(domain).get(0);
assertAboutDomains().that(domain)
.hasRegistrationExpirationTime(
@ -319,7 +319,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
String domainTld,
String responseXmlFile,
UserPrivileges userPrivileges) throws Exception {
doSuccessfulTest(domainTld, responseXmlFile, userPrivileges, ImmutableMap.<String, String>of());
doSuccessfulTest(domainTld, responseXmlFile, userPrivileges, ImmutableMap.of());
}
private void doSuccessfulTest(
@ -788,7 +788,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_claimsNoticeProvided_nameNotOnClaimsList() throws Exception {
setEppInput("domain_create_claim_notice.xml");
persistClaimsList(ImmutableMap.<String, String>of());
persistClaimsList(ImmutableMap.of());
persistContactsAndHosts();
thrown.expect(UnexpectedClaimsNoticeException.class);
runFlow();
@ -1599,7 +1599,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of("irrelevant"))
.setAllowedTlds(ImmutableSet.of("irrelevant"))
.build());
persistContactsAndHosts();
thrown.expect(NotAuthorizedForTldException.class);

View file

@ -16,7 +16,6 @@ package google.registry.flows.domain;
import static com.google.common.collect.MoreCollectors.onlyElement;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
@ -261,7 +260,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
private void doImmediateDeleteTest(GracePeriodStatus gracePeriodStatus, String responseFilename)
throws Exception {
doImmediateDeleteTest(gracePeriodStatus, responseFilename, ImmutableMap.<String, String>of());
doImmediateDeleteTest(gracePeriodStatus, responseFilename, ImmutableMap.of());
}
private void doImmediateDeleteTest(
@ -289,7 +288,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_addGracePeriodResultsInImmediateDelete() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
doImmediateDeleteTest(GracePeriodStatus.ADD, "domain_delete_response.xml");
}
@ -313,12 +312,12 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_sunrushAddGracePeriodResultsInImmediateDelete() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
doImmediateDeleteTest(GracePeriodStatus.SUNRUSH_ADD, "domain_delete_response.xml");
}
private void doSuccessfulTest_noAddGracePeriod(String responseFilename) throws Exception {
doSuccessfulTest_noAddGracePeriod(responseFilename, ImmutableMap.<String, String>of());
doSuccessfulTest_noAddGracePeriod(responseFilename, ImmutableMap.of());
}
private void doSuccessfulTest_noAddGracePeriod(
@ -372,7 +371,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_noAddGracePeriodResultsInPendingDelete() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
}
@ -415,7 +414,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_nonDefaultRedemptionGracePeriod() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
persistResource(
Registry.get("tld")
.asBuilder()
@ -426,7 +425,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_nonDefaultPendingDeleteLength() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
persistResource(
Registry.get("tld")
.asBuilder()
@ -588,7 +587,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testUnlinkingOfResources() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.<String>of());
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
setUpSuccessfulTest();
// Persist the billing event so it can be retrieved for cancellation generation and checking.
BillingEvent.OneTime graceBillingEvent =
@ -597,11 +596,11 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpGracePeriods(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, graceBillingEvent));
// Add a nameserver.
HostResource host = persistResource(newHostResource("ns1.example.tld"));
persistResource(loadByForeignKey(
DomainResource.class, getUniqueIdFromCommand(), clock.nowUtc())
.asBuilder()
.setNameservers(ImmutableSet.of(Key.create(host)))
.build());
persistResource(
loadByForeignKey(DomainResource.class, getUniqueIdFromCommand(), clock.nowUtc())
.asBuilder()
.setNameservers(ImmutableSet.of(Key.create(host)))
.build());
// Persist another domain that's already been deleted and references this contact and host.
persistResource(
newDomainResource("example1.tld")
@ -702,10 +701,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_notAuthorizedForTld() throws Exception {
setUpSuccessfulTest();
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
}
@ -714,10 +710,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
setUpSuccessfulTest();
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml"));

View file

@ -15,7 +15,6 @@
package google.registry.flows.domain;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
@ -127,7 +126,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
}
private void doSuccessfulTest(String responseFilename, int renewalYears) throws Exception {
doSuccessfulTest(responseFilename, renewalYears, ImmutableMap.<String, String>of());
doSuccessfulTest(responseFilename, renewalYears, ImmutableMap.of());
}
private void doSuccessfulTest(
@ -625,10 +624,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain();
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
@ -637,10 +633,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_renew_response.xml"));

View file

@ -15,7 +15,6 @@
package google.registry.flows.domain;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
import static google.registry.testing.DatastoreHelper.createTld;
@ -510,10 +509,7 @@ public class DomainRestoreRequestFlowTest extends
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain();
thrown.expect(NotAuthorizedForTldException.class);
runFlow();
@ -522,10 +518,7 @@ public class DomainRestoreRequestFlowTest extends
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml"));

View file

@ -16,7 +16,6 @@ package google.registry.flows.domain;
import static com.google.common.collect.MoreCollectors.onlyElement;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.NET_ADDS_4_YR;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
@ -309,7 +308,7 @@ public class DomainTransferApproveFlowTest
.build())
.toArray(BillingEvent.class));
// There should be no grace period.
assertGracePeriods(domain.getGracePeriods(), ImmutableMap.<GracePeriod, BillingEvent>of());
assertGracePeriods(domain.getGracePeriods(), ImmutableMap.of());
}
private void doSuccessfulTest(String tld, String commandFilename, String expectedXmlFilename)
@ -497,10 +496,7 @@ public class DomainTransferApproveFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
doSuccessfulTest("tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml");
}
@ -508,10 +504,7 @@ public class DomainTransferApproveFlowTest
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
runFlowAssertResponse(
CommitMode.LIVE,
UserPrivileges.SUPERUSER,

View file

@ -15,7 +15,6 @@
package google.registry.flows.domain;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.RESTORED_DOMAINS;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
@ -304,10 +303,7 @@ public class DomainTransferCancelFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
doSuccessfulTest("domain_transfer_cancel.xml", "domain_transfer_cancel_response.xml");
}
@ -315,15 +311,10 @@ public class DomainTransferCancelFlowTest
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.LIVE,
UserPrivileges.SUPERUSER,
readFile("domain_transfer_cancel_response.xml"));
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_transfer_cancel_response.xml"));
}
// NB: No need to test pending delete status since pending transfers will get cancelled upon

View file

@ -16,7 +16,6 @@ package google.registry.flows.domain;
import static com.google.common.collect.MoreCollectors.onlyElement;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.NET_RENEWS_3_YR;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_NACKED;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
@ -174,10 +173,7 @@ public class DomainTransferRejectFlowTest
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
doSuccessfulTest("domain_transfer_reject.xml", "domain_transfer_reject_response.xml");
}
@ -185,14 +181,9 @@ public class DomainTransferRejectFlowTest
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
runFlowAssertResponse(
CommitMode.LIVE,
UserPrivileges.SUPERUSER,
readFile("domain_transfer_reject_response.xml"));
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_transfer_reject_response.xml"));
}
@Test

View file

@ -276,7 +276,7 @@ public class DomainTransferRequestFlowTest
.build());
} else {
// Superuser transfers with no bundled renewal have no transfer billing event.
optionalTransferBillingEvent = Optional.<BillingEvent.OneTime>empty();
optionalTransferBillingEvent = Optional.empty();
}
// Construct the autorenew events for the losing/existing client and the gaining one. Note that
// all of the other transfer flow tests happen on day 3 of the transfer, but the initial
@ -347,9 +347,7 @@ public class DomainTransferRequestFlowTest
null),
optionalTransferBillingEvent.get()));
} else {
assertGracePeriods(
domainAfterAutomaticTransfer.getGracePeriods(),
ImmutableMap.<GracePeriod, BillingEvent>of());
assertGracePeriods(domainAfterAutomaticTransfer.getGracePeriods(), ImmutableMap.of());
}
}
@ -469,8 +467,8 @@ public class DomainTransferRequestFlowTest
commandFilename,
expectedXmlFilename,
expectedExpirationTime,
ImmutableMap.<String, String>of(),
Optional.<Money>empty(),
ImmutableMap.of(),
Optional.empty(),
extraExpectedBillingEvents);
}
@ -484,7 +482,7 @@ public class DomainTransferRequestFlowTest
expectedXmlFilename,
domain.getRegistrationExpirationTime().plusYears(1),
substitutions,
Optional.<Money>empty());
Optional.empty());
}
private void doSuccessfulTest(String commandFilename, String expectedXmlFilename)
@ -568,7 +566,7 @@ public class DomainTransferRequestFlowTest
}
private void runTest(String commandFilename, UserPrivileges userPrivileges) throws Exception {
runTest(commandFilename, userPrivileges, ImmutableMap.<String, String>of());
runTest(commandFilename, userPrivileges, ImmutableMap.of());
}
private void doFailingTest(
@ -577,7 +575,7 @@ public class DomainTransferRequestFlowTest
}
private void doFailingTest(String commandFilename) throws Exception {
runTest(commandFilename, UserPrivileges.NORMAL, ImmutableMap.<String, String> of());
runTest(commandFilename, UserPrivileges.NORMAL, ImmutableMap.of());
}
@Test
@ -756,7 +754,7 @@ public class DomainTransferRequestFlowTest
"domain_transfer_request_response_su_ext_zero_period_nonzero_transfer_length.xml",
domain.getRegistrationExpirationTime().plusYears(0),
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "5"),
Optional.<Money>empty(),
Optional.empty(),
Period.create(0, Unit.YEARS),
Duration.standardDays(5));
}
@ -772,7 +770,7 @@ public class DomainTransferRequestFlowTest
"domain_transfer_request_response_su_ext_zero_period_zero_transfer_length.xml",
domain.getRegistrationExpirationTime().plusYears(0),
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0"),
Optional.<Money>empty(),
Optional.empty(),
Period.create(0, Unit.YEARS),
Duration.ZERO);
}
@ -788,7 +786,7 @@ public class DomainTransferRequestFlowTest
"domain_transfer_request_response_su_ext_one_year_period_nonzero_transfer_length.xml",
domain.getRegistrationExpirationTime().plusYears(1),
ImmutableMap.of("PERIOD", "1", "AUTOMATIC_TRANSFER_LENGTH", "5"),
Optional.<Money>empty(),
Optional.empty(),
Period.create(1, Unit.YEARS),
Duration.standardDays(5));
}
@ -818,7 +816,7 @@ public class DomainTransferRequestFlowTest
"domain_transfer_request_response_su_ext_zero_period_autorenew_grace.xml",
domain.getRegistrationExpirationTime(),
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0"),
Optional.<Money>empty(),
Optional.empty(),
Period.create(0, Unit.YEARS),
Duration.ZERO);
}
@ -895,10 +893,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_notAuthorizedForTld() throws Exception {
setupDomain("example", "tld");
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
thrown.expect(NotAuthorizedForTldException.class);
doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml");
}
@ -907,10 +902,7 @@ public class DomainTransferRequestFlowTest
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
setupDomain("example", "tld");
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli();
// We don't verify the results; just check that the flow doesn't fail.
runTest("domain_transfer_request.xml", UserPrivileges.SUPERUSER);

View file

@ -17,7 +17,6 @@ package google.registry.flows.domain;
import static com.google.common.collect.Sets.union;
import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
@ -592,7 +591,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"domain_update_dsdata_rem_all.xml",
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
ImmutableSet.<DelegationSignerData>of());
ImmutableSet.of());
}
@Test
@ -975,10 +974,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistDomain();
thrown.expect(NotAuthorizedForTldException.class);
@ -988,10 +984,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistDomain();
clock.advanceOneMilli();