/* * Tests of updateAccountAmounts(PurchasingAccountsPayableDocument document) */ @ConfigureContext(session = appleton) public void testUpdateAccountAmounts_BeforeFullEntry_PercentToAmount() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS; PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem(); purapAccountingService.updateAccountAmounts(preq); assertFalse(preq.getItems().get(0).getTotalAmount().isZero()); }
@ConfigureContext(session = appleton, shouldCommitTransactions = true) public void testGenerateSummaryAccounts_OnePREQAccountOneItemWithPositiveTotal() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_ONE_ACCOUNT; PurchasingAccountsPayableDocument doc = fixture.generatePaymentRequestDocument_OneItem(); makePerAccountComparisons(fixture, doc); }
@ConfigureContext(session = appleton) public void testUpdateAccountAmounts_AfterFullEntry_PercentNotToAmount() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS; PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem(); preq.setApplicationDocumentStatus( PurapConstants.PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED); preq.getItems().get(0).setExtendedPrice(KualiDecimal.ZERO); purapAccountingService.updateAccountAmounts(preq); assertTrue(preq.getItems().get(0).getTotalAmount().isZero()); }
/* * Tests of deleteSummaryAccounts(Integer purapDocumentIdentifier) */ @ConfigureContext(session = appleton, shouldCommitTransactions = true) public void testDeleteSummaryAccounts_PaymentRequest() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_ONE_ACCOUNT; PaymentRequestDocument preq = fixture.generatePaymentRequestDocument_OneItem(); List<SummaryAccount> summaryAccounts = purapAccountingService.generateSummaryAccounts(preq); assertNotNull(summaryAccounts); purapAccountingService.deleteSummaryAccounts( preq.getPurapDocumentIdentifier(), PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT); assertNull( purapAccountingService.getAccountsPayableSummaryAccounts( preq.getPurapDocumentIdentifier(), PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT)); }
@ConfigureContext(session = appleton) public void testUpdateAccountAmounts_AfterFullEntry_AmountToPercent() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS; PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem(); preq.setApplicationDocumentStatus( PurapConstants.PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED); purapAccountingService.updateAccountAmounts(preq); PurApItem item = preq.getItems().get(0); int i = 0; for (PurApAccountingLine correctLine : fixture.getPurApAccountingLineList()) { PurApAccountingLine line = item.getSourceAccountingLines().get(i++); assertTrue(line.getAccountLinePercent().equals(correctLine.getAccountLinePercent())); } }
@ConfigureContext(session = appleton) public void testUpdateAccountAmounts_BeforeFullEntry_AmountNotToPercent() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS; PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem(); purapAccountingService.updateAccountAmounts(preq); PurApItem item = preq.getItems().get(0); int i = 0; boolean orResult = false; for (PurApAccountingLine correctLine : fixture.getPurApAccountingLineList()) { PurApAccountingLine line = item.getSourceAccountingLines().get(i++); if (!line.getAccountLinePercent().equals(correctLine.getAccountLinePercent())) { orResult = true; break; } } assertFalse(orResult); }
/* * Tests of generateAccountDistributionForProrationWithZeroTotal(PurchasingAccountsPayableDocument purapdoc) */ @ConfigureContext(session = appleton, shouldCommitTransactions = true) public void testGenerateAccountDistributionForProrationWithZeroTotal_OneAcct() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_ONE_ACCOUNT_ZERO_TOTAL; PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem(); List<PurApAccountingLine> distributedAccounts = null; try { distributedAccounts = purapAccountingService.generateAccountDistributionForProrationWithZeroTotal(preq); } catch (RuntimeException re) { fail(re.toString()); } List<BigDecimal> correctPercents = new ArrayList<BigDecimal>(); correctPercents.add(0, new BigDecimal("100")); assertEquals(distributedAccounts.size(), correctPercents.size()); comparePercentages(distributedAccounts, correctPercents); }