use of org.folio.rest.jaxrs.model.EncumbranceRollover in project mod-orders by folio-org.
the class ReEncumbranceHoldersBuilderTest method shouldNotPopulateReEncumbranceHoldersWithEncumbranceRolloverWhenEncumbranceRolloversNotContainsItemWithOrderType.
@Test
void shouldNotPopulateReEncumbranceHoldersWithEncumbranceRolloverWhenEncumbranceRolloversNotContainsItemWithOrderType() {
EncumbranceRollover oneTimeEncumbranceRollover = new EncumbranceRollover().withBasedOn(EncumbranceRollover.BasedOn.REMAINING).withOrderType(EncumbranceRollover.OrderType.ONE_TIME).withIncreaseBy(10d);
EncumbranceRollover ongoingEncumbranceRollover = new EncumbranceRollover().withBasedOn(EncumbranceRollover.BasedOn.EXPENDED).withOrderType(EncumbranceRollover.OrderType.ONGOING).withIncreaseBy(10d);
CompositePurchaseOrder compPO = new CompositePurchaseOrder().withOrderType(CompositePurchaseOrder.OrderType.ONGOING).withOngoing(new Ongoing().withIsSubscription(true));
LedgerFiscalYearRollover rollover = new LedgerFiscalYearRollover().withEncumbrancesRollover(Arrays.asList(oneTimeEncumbranceRollover, ongoingEncumbranceRollover));
ReEncumbranceHolder holder1 = new ReEncumbranceHolder().withPurchaseOrder(compPO).withRollover(rollover);
ReEncumbranceHolder holder2 = new ReEncumbranceHolder().withPurchaseOrder(compPO).withRollover(rollover);
List<ReEncumbranceHolder> holders = Arrays.asList(holder1, holder2);
List<ReEncumbranceHolder> resultHolders = reEncumbranceHoldersBuilder.withEncumbranceRollover(holders);
assertThat(resultHolders, everyItem(hasProperty("encumbranceRollover", nullValue())));
}
use of org.folio.rest.jaxrs.model.EncumbranceRollover in project mod-orders by folio-org.
the class ReEncumbranceHoldersBuilderTest method shouldPopulateReEncumbranceHoldersWithOngoingSubscriptionEncumbranceRolloverWhenOrderTypeOngoingAndSubscriptionTrue.
@Test
void shouldPopulateReEncumbranceHoldersWithOngoingSubscriptionEncumbranceRolloverWhenOrderTypeOngoingAndSubscriptionTrue() {
EncumbranceRollover oneTimeEncumbranceRollover = new EncumbranceRollover().withBasedOn(EncumbranceRollover.BasedOn.REMAINING).withOrderType(EncumbranceRollover.OrderType.ONE_TIME).withIncreaseBy(10d);
EncumbranceRollover ongoingEncumbranceRollover = new EncumbranceRollover().withBasedOn(EncumbranceRollover.BasedOn.EXPENDED).withOrderType(EncumbranceRollover.OrderType.ONGOING).withIncreaseBy(10d);
EncumbranceRollover subscriptionEncumbranceRollover = new EncumbranceRollover().withBasedOn(EncumbranceRollover.BasedOn.REMAINING).withOrderType(EncumbranceRollover.OrderType.ONGOING_SUBSCRIPTION).withIncreaseBy(10d);
CompositePurchaseOrder compPO = new CompositePurchaseOrder().withOrderType(CompositePurchaseOrder.OrderType.ONGOING).withOngoing(new Ongoing().withIsSubscription(true));
LedgerFiscalYearRollover rollover = new LedgerFiscalYearRollover().withEncumbrancesRollover(Arrays.asList(oneTimeEncumbranceRollover, ongoingEncumbranceRollover, subscriptionEncumbranceRollover));
ReEncumbranceHolder holder1 = new ReEncumbranceHolder().withPurchaseOrder(compPO).withRollover(rollover);
ReEncumbranceHolder holder2 = new ReEncumbranceHolder().withPurchaseOrder(compPO).withRollover(rollover);
List<ReEncumbranceHolder> holders = Arrays.asList(holder1, holder2);
List<ReEncumbranceHolder> resultHolders = reEncumbranceHoldersBuilder.withEncumbranceRollover(holders);
assertThat(resultHolders, everyItem(hasProperty("encumbranceRollover", is(subscriptionEncumbranceRollover))));
}
Aggregations