mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 11:49:37 +02:00
Adding synthetic source ID to BillingEvent.OneTime
Synthetic BillingEvent.OneTimes need to have a pointer to their source Recurring event, in order to match up properly against Cancellations. Also improving the exception message for mismatched Flag.SYNTHETIC and syntheticCreationTime. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122155636
This commit is contained in:
parent
51362722cd
commit
a8544100fa
2 changed files with 44 additions and 3 deletions
|
@ -91,6 +91,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
.setReason(Reason.CREATE)
|
||||
.setFlags(ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT, BillingEvent.Flag.SYNTHETIC))
|
||||
.setSyntheticCreationTime(now.plusDays(10))
|
||||
.setCancellationTargetId(1L)
|
||||
.setPeriodYears(2)
|
||||
.setCost(Money.of(USD, 1))
|
||||
.setEventTime(now)
|
||||
|
@ -179,7 +180,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
public void testFailure_syntheticFlagWithoutCreationTime() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Billing events with SYNTHETIC flag set must have a synthetic creation time");
|
||||
"Synthetic creation time must be set if and only if the SYNTHETIC flag is set.");
|
||||
oneTime.asBuilder()
|
||||
.setFlags(ImmutableSet.of(BillingEvent.Flag.SYNTHETIC))
|
||||
.build();
|
||||
|
@ -189,12 +190,32 @@ public class BillingEventTest extends EntityTestCase {
|
|||
public void testFailure_syntheticCreationTimeWithoutFlag() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Billing events with SYNTHETIC flag set must have a synthetic creation time");
|
||||
"Synthetic creation time must be set if and only if the SYNTHETIC flag is set");
|
||||
oneTime.asBuilder()
|
||||
.setSyntheticCreationTime(now.plusDays(10))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_syntheticFlagWithoutCancellationTargetId() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Synthetic creation time must be set if and only if the SYNTHETIC flag is set.");
|
||||
oneTime.asBuilder()
|
||||
.setFlags(ImmutableSet.of(BillingEvent.Flag.SYNTHETIC))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_cancellationTargetIdWithoutFlag() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Cancellation target ID must be set if and only if the SYNTHETIC flag is set");
|
||||
oneTime.asBuilder()
|
||||
.setCancellationTargetId(2L)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_cancellation_forGracePeriod_withOneTime() {
|
||||
BillingEvent.Cancellation newCancellation = BillingEvent.Cancellation.forGracePeriod(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue