Declare types in ImmutableSet.of() usage

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167625611
This commit is contained in:
bbilbo 2017-09-05 13:48:02 -07:00 committed by jianglai
parent fa70bd272a
commit 57bcd6b1eb
4 changed files with 9 additions and 7 deletions

View file

@ -119,7 +119,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
// the transfer period to zero. There is not a transfer cost if the transfer period is zero. // the transfer period to zero. There is not a transfer cost if the transfer period is zero.
Optional<BillingEvent.OneTime> billingEvent = Optional<BillingEvent.OneTime> billingEvent =
(transferData.getTransferPeriod().getValue() == 0) (transferData.getTransferPeriod().getValue() == 0)
? Optional.absent() ? Optional.<BillingEvent.OneTime>absent()
: Optional.of( : Optional.of(
new BillingEvent.OneTime.Builder() new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER) .setReason(Reason.TRANSFER)

View file

@ -75,6 +75,7 @@ import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import javax.inject.Inject; import javax.inject.Inject;
import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
@ -162,7 +163,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
// If the period is zero, then there is no fee for the transfer. // If the period is zero, then there is no fee for the transfer.
Optional<FeesAndCredits> feesAndCredits = Optional<FeesAndCredits> feesAndCredits =
(period.getValue() == 0) (period.getValue() == 0)
? Optional.absent() ? Optional.<FeesAndCredits>absent()
: Optional.of(pricingLogic.getTransferPrice(registry, targetId, now)); : Optional.of(pricingLogic.getTransferPrice(registry, targetId, now));
if (feesAndCredits.isPresent()) { if (feesAndCredits.isPresent()) {
validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits.get()); validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits.get());
@ -206,7 +207,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
gainingClientId, gainingClientId,
(feesAndCredits.isPresent()) (feesAndCredits.isPresent())
? Optional.of(feesAndCredits.get().getTotalCost()) ? Optional.of(feesAndCredits.get().getTotalCost())
: Optional.absent(), : Optional.<Money>absent(),
now); now);
// Create the transfer data that represents the pending transfer. // Create the transfer data that represents the pending transfer.
TransferData pendingTransferData = TransferData pendingTransferData =

View file

@ -277,7 +277,7 @@ public class DomainResource extends DomainBase
transferData.getServerApproveBillingEvent()))); transferData.getServerApproveBillingEvent())));
} else { } else {
// There won't be a billing event, so we don't need a grace period // There won't be a billing event, so we don't need a grace period
builder.setGracePeriods(ImmutableSet.of()); builder.setGracePeriods(ImmutableSet.<GracePeriod>of());
} }
// Set all remaining transfer properties. // Set all remaining transfer properties.
setAutomaticTransferSuccessProperties(builder, transferData); setAutomaticTransferSuccessProperties(builder, transferData);

View file

@ -183,7 +183,7 @@ public class DomainTransferRequestFlowTest
final HistoryEntry historyEntryTransferRequest = final HistoryEntry historyEntryTransferRequest =
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST); getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
subordinateHost = reloadResourceAndCloneAtTime(subordinateHost, clock.nowUtc()); subordinateHost = reloadResourceAndCloneAtTime(subordinateHost, clock.nowUtc());
assertTransferRequested(domain, Optional.absent()); assertTransferRequested(domain, Optional.<Duration>absent());
assertAboutDomains().that(domain) assertAboutDomains().that(domain)
.hasPendingTransferExpirationTime(implicitTransferTime).and() .hasPendingTransferExpirationTime(implicitTransferTime).and()
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST); .hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST);
@ -201,10 +201,11 @@ public class DomainTransferRequestFlowTest
originalGracePeriods, originalGracePeriods,
extraExpectedBillingEvents); extraExpectedBillingEvents);
assertPollMessagesEmitted(expectedExpirationTime, implicitTransferTime, Optional.absent()); assertPollMessagesEmitted(
expectedExpirationTime, implicitTransferTime, Optional.<Duration>absent());
assertAboutDomainAfterAutomaticTransfer( assertAboutDomainAfterAutomaticTransfer(
expectedExpirationTime, implicitTransferTime, Optional.absent()); expectedExpirationTime, implicitTransferTime, Optional.<Duration>absent());
} }
private void assertHistoryEntriesContainBillingEventsAndGracePeriods( private void assertHistoryEntriesContainBillingEventsAndGracePeriods(