Create a separate billing event when EAP is applied

When EAP is involed we current have one billing event for domain create that
has the create fee and EAP fee lumped together. Change it to record two
separate billing events for each.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132335349
This commit is contained in:
jianglai 2016-09-06 10:28:56 -07:00 committed by Ben McIlwain
parent 969d9483ae
commit 6641f105b7
12 changed files with 196 additions and 72 deletions

View file

@ -14,11 +14,13 @@
package google.registry.flows.domain; package google.registry.flows.domain;
import static com.google.common.collect.Sets.union;
import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge; import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER; import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName; import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -146,23 +148,42 @@ public class DomainCreateFlow extends DomainCreateOrAllocateFlow {
Registry registry = Registry.get(getTld()); Registry registry = Registry.get(getTld());
// Bill for the create. // Bill for the create.
BillingEvent.OneTime createEvent = new BillingEvent.OneTime.Builder() BillingEvent.OneTime createEvent =
.setReason(Reason.CREATE) new BillingEvent.OneTime.Builder()
.setTargetId(targetId) .setReason(Reason.CREATE)
.setClientId(getClientId()) .setTargetId(targetId)
.setPeriodYears(command.getPeriod().getValue()) .setClientId(getClientId())
// TODO(b/29089413): the EAP fee needs to be a separate billing event. .setPeriodYears(command.getPeriod().getValue())
.setCost(commandOperations.getTotalCost()) .setCost(commandOperations.getCreateCost())
.setEventTime(now) .setEventTime(now)
.setBillingTime(now.plus(isAnchorTenant() .setBillingTime(now.plus(isAnchorTenant()
? registry.getAnchorTenantAddGracePeriodLength() ? registry.getAnchorTenantAddGracePeriodLength()
: registry.getAddGracePeriodLength())) : registry.getAddGracePeriodLength()))
.setFlags(isAnchorTenant() .setFlags(isAnchorTenant()
? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT) ? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT)
: ImmutableSet.<BillingEvent.Flag>of()) : ImmutableSet.<BillingEvent.Flag>of())
.setParent(historyEntry) .setParent(historyEntry)
.build(); .build();
ofy().save().entity(createEvent); ofy().save().entity(createEvent);
// Bill for EAP cost, if any.
if (!commandOperations.getEapCost().isZero()) {
BillingEvent.OneTime eapEvent =
new BillingEvent.OneTime.Builder()
.setReason(createEvent.getReason())
.setTargetId(createEvent.getTargetId())
.setClientId(createEvent.getClientId())
.setPeriodYears(createEvent.getPeriodYears())
.setCost(commandOperations.getEapCost())
.setEventTime(createEvent.getEventTime())
.setBillingTime(createEvent.getBillingTime())
.setFlags(union(createEvent.getFlags(),
ImmutableSet.of(BillingEvent.Flag.EAP)).immutableCopy())
.setParent(createEvent.getParentKey())
.build();
ofy().save().entity(eapEvent);
}
builder.addGracePeriod(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, createEvent)); builder.addGracePeriod(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, createEvent));
if (launchCreate != null && (launchCreate.getNotice() != null || hasSignedMarks)) { if (launchCreate != null && (launchCreate.getNotice() != null || hasSignedMarks)) {
builder builder

View file

@ -42,6 +42,7 @@ import google.registry.model.domain.DomainRenewData;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
@ -174,13 +175,16 @@ public class DomainRenewFlow extends OwnedResourceMutateFlow<DomainResource, Ren
return createOutput( return createOutput(
Success, Success,
DomainRenewData.create( DomainRenewData.create(
newResource.getFullyQualifiedDomainName(), newResource.getFullyQualifiedDomainName(), newResource.getRegistrationExpirationTime()),
newResource.getRegistrationExpirationTime()), (feeRenew == null)
(feeRenew == null) ? null : ImmutableList.of( ? null
feeRenew.createResponseBuilder() : ImmutableList.of(
.setCurrency(renewCost.getCurrencyUnit()) feeRenew
.setFees(ImmutableList.of(Fee.create(renewCost.getAmount(), "renew"))) .createResponseBuilder()
.build())); .setCurrency(renewCost.getCurrencyUnit())
.setFees(
ImmutableList.of(Fee.create(renewCost.getAmount(), FeeType.RENEW)))
.build()));
} }
/** The domain has a pending transfer on it and so can't be explicitly renewed. */ /** The domain has a pending transfer on it and so can't be explicitly renewed. */

View file

@ -38,6 +38,7 @@ import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.domain.DomainCommand.Update; import google.registry.model.domain.DomainCommand.Update;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
@ -187,13 +188,17 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
return createOutput( return createOutput(
Success, Success,
null, null,
(feeUpdate == null) ? null : ImmutableList.of( (feeUpdate == null)
feeUpdate.createResponseBuilder() ? null
.setCurrency(restoreCost.getCurrencyUnit()) : ImmutableList.of(
.setFees(ImmutableList.of( feeUpdate
Fee.create(restoreCost.getAmount(), "restore"), .createResponseBuilder()
Fee.create(renewCost.getAmount(), "renew"))) .setCurrency(restoreCost.getCurrencyUnit())
.build())); .setFees(
ImmutableList.of(
Fee.create(restoreCost.getAmount(), FeeType.RESTORE),
Fee.create(renewCost.getAmount(), FeeType.RENEW)))
.build()));
} }
/** Restore command cannot have other changes specified. */ /** Restore command cannot have other changes specified. */

View file

@ -36,6 +36,7 @@ import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.domain.DomainCommand.Transfer; import google.registry.model.domain.DomainCommand.Transfer;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.eppoutput.EppResponse.ResponseExtension; import google.registry.model.eppoutput.EppResponse.ResponseExtension;
@ -161,10 +162,12 @@ public class DomainTransferRequestFlow
@Override @Override
protected ImmutableList<? extends ResponseExtension> getTransferResponseExtensions() { protected ImmutableList<? extends ResponseExtension> getTransferResponseExtensions() {
if (feeTransfer != null) { if (feeTransfer != null) {
return ImmutableList.of(feeTransfer.createResponseBuilder() return ImmutableList.of(
.setCurrency(renewCost.getCurrencyUnit()) feeTransfer
.setFees(ImmutableList.of(Fee.create(renewCost.getAmount(), "renew"))) .createResponseBuilder()
.build()); .setCurrency(renewCost.getCurrencyUnit())
.setFees(ImmutableList.of(Fee.create(renewCost.getAmount(), FeeType.RENEW)))
.build());
} else { } else {
return null; return null;
} }

View file

@ -71,6 +71,7 @@ public abstract class BillingEvent extends ImmutableObject
ALLOCATION, ALLOCATION,
ANCHOR_TENANT, ANCHOR_TENANT,
AUTO_RENEW, AUTO_RENEW,
EAP,
LANDRUSH, LANDRUSH,
SUNRISE, SUNRISE,
/** /**

View file

@ -15,6 +15,7 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkState;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import google.registry.xml.PeriodAdapter; import google.registry.xml.PeriodAdapter;
@ -39,6 +40,24 @@ public abstract class BaseFee extends ImmutableObject {
DELAYED DELAYED
} }
/** Enum for the type of the fee. */
public enum FeeType {
CREATE("create"),
EAP("Early Access Period, fee expires: %s"),
RENEW("renew"),
RESTORE("restore");
private final String formatString;
FeeType(String formatString) {
this.formatString = formatString;
}
String renderDescription(Object... args) {
return String.format(formatString, args);
}
}
@XmlAttribute @XmlAttribute
String description; String description;
@ -55,6 +74,9 @@ public abstract class BaseFee extends ImmutableObject {
@XmlValue @XmlValue
BigDecimal cost; BigDecimal cost;
@XmlTransient
FeeType type;
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -82,6 +104,15 @@ public abstract class BaseFee extends ImmutableObject {
return cost; return cost;
} }
public FeeType getType() {
return type;
}
protected void generateDescription(Object... args) {
checkState(type != null);
description = type.renderDescription(args);
}
public boolean hasDefaultAttributes() { public boolean hasDefaultAttributes() {
return getGracePeriod().equals(Period.ZERO) return getGracePeriod().equals(Period.ZERO)
&& getApplied().equals(AppliedType.IMMEDIATE) && getApplied().equals(AppliedType.IMMEDIATE)

View file

@ -37,13 +37,17 @@ import google.registry.model.domain.fee12.FeeUpdateCommandExtensionV12;
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension; import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
import java.math.BigDecimal; import java.math.BigDecimal;
/** A fee, in currency units specified elsewhere in the xml, and with an optional description. */ /**
* A fee, in currency units specified elsewhere in the xml, with type of the fee an optional fee
* description.
*/
public class Fee extends BaseFee { public class Fee extends BaseFee {
public static Fee create(BigDecimal cost, String description) { public static Fee create(BigDecimal cost, FeeType type, Object... descriptionArgs) {
Fee instance = new Fee(); Fee instance = new Fee();
instance.cost = checkNotNull(cost); instance.cost = checkNotNull(cost);
checkArgument(instance.cost.signum() >= 0); checkArgument(instance.cost.signum() >= 0);
instance.description = description; instance.type = checkNotNull(type);
instance.generateDescription(descriptionArgs);
return instance; return instance;
} }

View file

@ -26,6 +26,7 @@ import com.googlecode.objectify.Key;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import google.registry.model.domain.DomainCommand.Create; import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.LrpToken; import google.registry.model.domain.LrpToken;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.EapFee; import google.registry.model.domain.fee.EapFee;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices; import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
@ -39,9 +40,6 @@ import org.joda.time.DateTime;
* implementations on a per-TLD basis. * implementations on a per-TLD basis.
*/ */
public final class TldSpecificLogicProxy { public final class TldSpecificLogicProxy {
private static final String EAP_DESCRIPTION_FORMAT = "Early Access Period, fee expires: %s";
/** /**
* A collection of fees for a specific event. * A collection of fees for a specific event.
*/ */
@ -56,9 +54,18 @@ public final class TldSpecificLogicProxy {
this.fees = checkArgumentNotNull(fees, "Fees may not be null in EppCommandOperations."); this.fees = checkArgumentNotNull(fees, "Fees may not be null in EppCommandOperations.");
} }
/** private Money getTotalCostForType(FeeType type) {
* Returns the total cost of all fees for the event. Money result = Money.zero(currency);
*/ checkArgumentNotNull(type);
for (Fee fee : fees) {
if (fee.getType() == type) {
result = result.plus(fee.getCost());
}
}
return result;
}
/** Returns the total cost of all fees for the event. */
public Money getTotalCost() { public Money getTotalCost() {
Money result = Money.zero(currency); Money result = Money.zero(currency);
for (Fee fee : fees) { for (Fee fee : fees) {
@ -67,6 +74,16 @@ public final class TldSpecificLogicProxy {
return result; return result;
} }
/** Returns the create cost for the event. */
public Money getCreateCost() {
return getTotalCostForType(FeeType.CREATE);
}
/** Returns the EAP cost for the event. */
public Money getEapCost() {
return getTotalCostForType(FeeType.EAP);
}
/** /**
* Returns all costs for the event as a list of fees. * Returns all costs for the event as a list of fees.
*/ */
@ -94,7 +111,8 @@ public final class TldSpecificLogicProxy {
ImmutableList.Builder<Fee> feeBuilder = new ImmutableList.Builder<>(); ImmutableList.Builder<Fee> feeBuilder = new ImmutableList.Builder<>();
// Add Create cost. // Add Create cost.
feeBuilder.add(Fee.create(prices.getCreateCost().multipliedBy(years).getAmount(), "create")); feeBuilder.add(
Fee.create(prices.getCreateCost().multipliedBy(years).getAmount(), FeeType.CREATE));
// Add EAP Fee. // Add EAP Fee.
EapFee eapFee = registry.getEapFeeFor(date); EapFee eapFee = registry.getEapFeeFor(date);
@ -103,8 +121,7 @@ public final class TldSpecificLogicProxy {
if (!eapFeeCost.getAmount().equals(Money.zero(currency).getAmount())) { if (!eapFeeCost.getAmount().equals(Money.zero(currency).getAmount())) {
feeBuilder.add( feeBuilder.add(
Fee.create( Fee.create(
eapFeeCost.getAmount(), eapFeeCost.getAmount(), FeeType.EAP, eapFee.getPeriod().upperEndpoint()));
String.format(EAP_DESCRIPTION_FORMAT, eapFee.getPeriod().upperEndpoint())));
} }
return new EppCommandOperations(currency, feeBuilder.build()); return new EppCommandOperations(currency, feeBuilder.build());
@ -119,7 +136,8 @@ public final class TldSpecificLogicProxy {
return new EppCommandOperations( return new EppCommandOperations(
registry.getCurrency(), registry.getCurrency(),
ImmutableList.of( ImmutableList.of(
Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew"))); Fee.create(
prices.getRenewCost().multipliedBy(years).getAmount(), FeeType.RENEW)));
} }
/** /**
@ -131,8 +149,9 @@ public final class TldSpecificLogicProxy {
return new EppCommandOperations( return new EppCommandOperations(
registry.getCurrency(), registry.getCurrency(),
ImmutableList.of( ImmutableList.of(
Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew"), Fee.create(
Fee.create(registry.getStandardRestoreCost().getAmount(), "restore"))); prices.getRenewCost().multipliedBy(years).getAmount(), FeeType.RENEW),
Fee.create(registry.getStandardRestoreCost().getAmount(), FeeType.RESTORE)));
} }
/** /**

View file

@ -169,9 +169,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
? Money.of(USD, 200) ? Money.of(USD, 200)
: Money.of(USD, 26); : Money.of(USD, 26);
Money eapFee = Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost(); Money eapFee = Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost();
if (!eapFee.isZero()) {
cost = Money.total(cost, eapFee);
}
DateTime billingTime = isAnchorTenant DateTime billingTime = isAnchorTenant
? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength()) ? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength())
@ -186,20 +183,21 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.hasOnlyOneHistoryEntryWhich() .hasOnlyOneHistoryEntryWhich()
.hasType(HistoryEntry.Type.DOMAIN_CREATE).and() .hasType(HistoryEntry.Type.DOMAIN_CREATE).and()
.hasPeriodYears(2); .hasPeriodYears(2);
// There should be a bill for the create and a recurring autorenew event. // There should be one bill for the create and one for the recurring autorenew event.
BillingEvent.OneTime createBillingEvent = new BillingEvent.OneTime.Builder() BillingEvent.OneTime createBillingEvent =
.setReason(Reason.CREATE) new BillingEvent.OneTime.Builder()
.setTargetId(getUniqueIdFromCommand()) .setReason(Reason.CREATE)
.setClientId("TheRegistrar") .setTargetId(getUniqueIdFromCommand())
.setCost(cost) .setClientId("TheRegistrar")
.setPeriodYears(2) .setCost(cost)
.setEventTime(clock.nowUtc()) .setPeriodYears(2)
.setBillingTime(billingTime) .setEventTime(clock.nowUtc())
.setFlags(billingFlags) .setBillingTime(billingTime)
.setParent(historyEntry) .setFlags(billingFlags)
.build(); .setParent(historyEntry)
assertBillingEvents( .build();
createBillingEvent,
BillingEvent.Recurring renewBillingEvent =
new BillingEvent.Recurring.Builder() new BillingEvent.Recurring.Builder()
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
@ -208,7 +206,36 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setEventTime(domain.getRegistrationExpirationTime()) .setEventTime(domain.getRegistrationExpirationTime())
.setRecurrenceEndTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME)
.setParent(historyEntry) .setParent(historyEntry)
.build()); .build();
ImmutableSet<BillingEvent> billingEvents = ImmutableSet.of(
createBillingEvent, renewBillingEvent);
// If EAP is applied, a billing event for EAP should be present.
if (!eapFee.isZero()) {
ImmutableSet<BillingEvent.Flag> eapFlags =
isAnchorTenant
? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT, BillingEvent.Flag.EAP)
: ImmutableSet.of(BillingEvent.Flag.EAP);
BillingEvent.OneTime eapBillingEvent =
new BillingEvent.OneTime.Builder()
.setReason(Reason.CREATE)
.setTargetId(getUniqueIdFromCommand())
.setClientId("TheRegistrar")
.setCost(eapFee)
.setPeriodYears(2)
.setEventTime(clock.nowUtc())
.setBillingTime(billingTime)
.setFlags(eapFlags)
.setParent(historyEntry)
.build();
billingEvents = ImmutableSet.<BillingEvent>builder()
.addAll(billingEvents)
.add(eapBillingEvent)
.build();
}
assertBillingEvents(billingEvents);
assertGracePeriods( assertGracePeriods(
domain.getGracePeriods(), domain.getGracePeriods(),
ImmutableMap.of( ImmutableMap.of(

View file

@ -24,6 +24,7 @@ enum google.registry.model.billing.BillingEvent$Flag {
ALLOCATION; ALLOCATION;
ANCHOR_TENANT; ANCHOR_TENANT;
AUTO_RENEW; AUTO_RENEW;
EAP;
LANDRUSH; LANDRUSH;
SUNRISE; SUNRISE;
SYNTHETIC; SYNTHETIC;

View file

@ -22,6 +22,7 @@ import static org.joda.money.CurrencyUnit.USD;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
@ -88,18 +89,18 @@ public class TldSpecificLogicProxyTest {
assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost.plus(Money.of(USD, 100))); assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost.plus(Money.of(USD, 100)));
assertThat(createPrice.getCurrency()).isEqualTo(USD); assertThat(createPrice.getCurrency()).isEqualTo(USD);
assertThat(createPrice.getFees().get(0)) assertThat(createPrice.getFees().get(0))
.isEqualTo(Fee.create(basicCreateCost.getAmount(), "create")); .isEqualTo(Fee.create(basicCreateCost.getAmount(), FeeType.CREATE));
assertThat(createPrice.getFees().get(1)) assertThat(createPrice.getFees().get(1))
.isEqualTo( .isEqualTo(
Fee.create( Fee.create(
Money.of(USD, 100).getAmount(), Money.of(USD, 100).getAmount(), FeeType.EAP, clock.nowUtc().plusDays(1)));
"Early Access Period, fee expires: " + clock.nowUtc().plusDays(1)));
assertThat(createPrice.getFees()) assertThat(createPrice.getFees())
.isEqualTo( .isEqualTo(
ImmutableList.of( ImmutableList.of(
Fee.create(basicCreateCost.getAmount(), "create"), Fee.create(basicCreateCost.getAmount(), FeeType.CREATE),
Fee.create( Fee.create(
Money.of(USD, 100).getAmount(), Money.of(USD, 100).getAmount(),
"Early Access Period, fee expires: " + clock.nowUtc().plusDays(1)))); FeeType.EAP,
clock.nowUtc().plusDays(1))));
} }
} }

View file

@ -608,6 +608,13 @@ public class DatastoreHelper {
FluentIterable.from(asList(expected)).transform(BILLING_EVENT_ID_STRIPPER)); FluentIterable.from(asList(expected)).transform(BILLING_EVENT_ID_STRIPPER));
} }
/** Assert that the expected billing events set is exactly the one found in the fake datastore. */
public static void assertBillingEvents(ImmutableSet<BillingEvent> expected) throws Exception {
assertThat(FluentIterable.from(getBillingEvents()).transform(BILLING_EVENT_ID_STRIPPER))
.containsExactlyElementsIn(
FluentIterable.from(expected.asList()).transform(BILLING_EVENT_ID_STRIPPER));
}
/** /**
* Assert that the expected billing events are exactly the ones found for the given EppResource. * Assert that the expected billing events are exactly the ones found for the given EppResource.
*/ */