public void testGenerateSummary_TwoItems_OneAccount() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.REQ_SUMMARY_TWO_ITEMS_ONE_ACCOUNT; List<SourceAccountingLine> originalSourceAccounts = fixture.getSourceAccountingLineList(); List<PurApItem> items = fixture.getItems(); List<SourceAccountingLine> sourceLines = purapAccountingService.generateSummary(items); assertEquals(sourceLines.size(), originalSourceAccounts.size()); checkAccountConsolidation(sourceLines, originalSourceAccounts); }
public void testGenerateSummary_OneItem_OneAccount() { // TestUtils.setSystemParameter(Document.class,PurapParameterConstants.ENABLE_SALES_TAX_IND,"Y"); PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.REQ_SUMMARY_ONE_ITEM_ONE_ACCOUNT; List<SourceAccountingLine> originalSourceAccounts = fixture.getSourceAccountingLineList(); List<PurApItem> items = fixture.getItems(); List<SourceAccountingLine> sourceLines = purapAccountingService.generateSummary(items); assertEquals(sourceLines.size(), originalSourceAccounts.size()); checkAccountConsolidation(sourceLines, originalSourceAccounts); }
public void testGenerateAccountDistributionForProration_OneAcctGood() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_ONE_ACCOUNT; List<PurApAccountingLine> distributedAccounts = purapAccountingService.generateAccountDistributionForProration( fixture.getSourceAccountingLineList(), fixture.getTotalAmount(), fixture.getPercentScale(), fixture.getAccountClass()); List<BigDecimal> correctPercents = new ArrayList<BigDecimal>(); correctPercents.add(0, new BigDecimal("100")); assertEquals(distributedAccounts.size(), correctPercents.size()); comparePercentages(distributedAccounts, correctPercents); }
/** * Used by tests of generateSummaryAccounts and related methods to marshall the comparisons of the * accounts and items of the generated summary accounts. * * @param fixture The PurapAccountingServiceFixture * @param document A PurchasingAccountsPayableDocument generated from the fixture. */ private void makePerAccountComparisons( PurapAccountingServiceFixture fixture, PurchasingAccountsPayableDocument doc) { int itemCount = doc.getItems().size(); List<SummaryAccount> accounts = purapAccountingService.generateSummaryAccounts(doc); List<SourceAccountingLine> originalSourceAccounts = fixture.getSourceAccountingLineList(); assertEquals(accounts.size(), originalSourceAccounts.size()); for (int i = 0; i < originalSourceAccounts.size(); i++) { SummaryAccount account = accounts.get(i); SourceAccountingLine sourceAccount = account.getAccount(); compareSourceAccounts(sourceAccount, originalSourceAccounts.get(i)); List<PurApSummaryItem> summaryItems = account.getItems(); assertTrue(summaryItems.size() <= itemCount); } }
public void testGenerateSummaryWithNoZeroTotalsUsingAlternateAmount_TwoItems_OneAccount() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.REQ_SUMMARY_TWO_ITEMS_ONE_ACCOUNT; List<SourceAccountingLine> originalSourceAccounts = fixture.getSourceAccountingLineList(); List<PurApItem> items = fixture.getItems(); GlobalVariables.getUserSession().setBackdoorUser("parke"); RequisitionDocumentFixture reqFixture = RequisitionDocumentFixture.REQ_ONLY_REQUIRED_FIELDS; RequisitionDocument req = reqFixture.createRequisitionDocument(); GlobalVariables.getUserSession().setBackdoorUser("kfs"); for (PurApItem item : items) { item.setPurapDocument(req); } List<SourceAccountingLine> sourceLines = purapAccountingService.generateSummaryWithNoZeroTotalsUsingAlternateAmount(items); assertEquals(sourceLines.size(), originalSourceAccounts.size()); checkAccountConsolidation(sourceLines, originalSourceAccounts); }