Search in sources :

Example 11 with EncumbranceRollover

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())));
}
Also used : EncumbranceRollover(org.folio.rest.jaxrs.model.EncumbranceRollover) ReEncumbranceHolder(org.folio.models.ReEncumbranceHolder) Ongoing(org.folio.rest.jaxrs.model.Ongoing) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) LedgerFiscalYearRollover(org.folio.rest.jaxrs.model.LedgerFiscalYearRollover) Test(org.junit.jupiter.api.Test)

Example 12 with EncumbranceRollover

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))));
}
Also used : EncumbranceRollover(org.folio.rest.jaxrs.model.EncumbranceRollover) ReEncumbranceHolder(org.folio.models.ReEncumbranceHolder) Ongoing(org.folio.rest.jaxrs.model.Ongoing) CompositePurchaseOrder(org.folio.rest.jaxrs.model.CompositePurchaseOrder) LedgerFiscalYearRollover(org.folio.rest.jaxrs.model.LedgerFiscalYearRollover) Test(org.junit.jupiter.api.Test)

Aggregations

EncumbranceRollover (org.folio.rest.jaxrs.model.EncumbranceRollover)12 LedgerFiscalYearRollover (org.folio.rest.jaxrs.model.LedgerFiscalYearRollover)11 Test (org.junit.jupiter.api.Test)11 ReEncumbranceHolder (org.folio.models.ReEncumbranceHolder)9 Transaction (org.folio.rest.acq.model.finance.Transaction)8 CompositePurchaseOrder (org.folio.rest.jaxrs.model.CompositePurchaseOrder)8 FundDistribution (org.folio.rest.jaxrs.model.FundDistribution)8 Encumbrance (org.folio.rest.acq.model.finance.Encumbrance)7 TransactionCollection (org.folio.rest.acq.model.finance.TransactionCollection)7 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 Cost (org.folio.rest.jaxrs.model.Cost)5 ConversionQuery (javax.money.convert.ConversionQuery)4 Fund (org.folio.rest.acq.model.finance.Fund)4 CompositePoLine (org.folio.rest.jaxrs.model.CompositePoLine)4 ManualCurrencyConversion (org.folio.service.exchange.ManualCurrencyConversion)4 ExchangeRate (javax.money.convert.ExchangeRate)3 ExchangeRateProvider (javax.money.convert.ExchangeRateProvider)3 PoLine (org.folio.rest.jaxrs.model.PoLine)3 PurchaseOrder (org.folio.rest.jaxrs.model.PurchaseOrder)3 PurchaseOrderCollection (org.folio.rest.jaxrs.model.PurchaseOrderCollection)3