use of edu.cornell.kfs.fp.batch.xml.fixture.AccountingXmlDocumentEntryFixture in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method buildExpectedDocumentsAndAppendToLists.
private void buildExpectedDocumentsAndAppendToLists(Consumer<AccountingXmlDocumentEntryFixture> fixtureListAppender, Consumer<AccountingDocument> documentListAppender, AccountingXmlDocumentEntryFixture... fixtures) {
MutableInt idCounter = new MutableInt(DOCUMENT_NUMBER_START);
Stream.of(fixtures).filter(this::isDocumentExpectedToReachInitiationPoint).map((fixture) -> buildDocumentIdToFixtureMapping(idCounter, fixture)).filter((mapping) -> isDocumentExpectedToPassBusinessRulesValidation(mapping.getValue())).peek((mapping) -> fixtureListAppender.accept(mapping.getValue())).map(this::buildExpectedDocument).forEach(documentListAppender);
}
use of edu.cornell.kfs.fp.batch.xml.fixture.AccountingXmlDocumentEntryFixture in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method assertDocumentsWereCreatedAndRoutedCorrectly.
private void assertDocumentsWereCreatedAndRoutedCorrectly(AccountingXmlDocumentEntryFixture... fixtures) {
List<AccountingXmlDocumentEntryFixture> expectedRoutableFixtures = new ArrayList<>(fixtures.length);
List<AccountingDocument> expectedAccountingDocuments = new ArrayList<>(fixtures.length);
buildExpectedDocumentsAndAppendToLists(expectedRoutableFixtures::add, expectedAccountingDocuments::add, fixtures);
assertEquals("Wrong number of routed documents", expectedAccountingDocuments.size(), routedAccountingDocuments.size());
for (int i = 0; i < expectedAccountingDocuments.size(); i++) {
AccountingXmlDocumentEntryFixture fixture = expectedRoutableFixtures.get(i);
Class<? extends AccountingDocument> expectedDocumentClass = AccountingDocumentClassMappingUtils.getDocumentClassByDocumentType(fixture.documentTypeCode);
assertAccountingDocumentIsCorrect(expectedDocumentClass, expectedAccountingDocuments.get(i), routedAccountingDocuments.get(i));
}
}
Aggregations