use of edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument in project cu-kfs by CU-CommunityApps.
the class FavoriteAccountLineBuilderTest method createBuilderForIWant.
private PurApFavoriteAccountLineBuilderForIWantDocument createBuilderForIWant(IWantDocument document) {
PurApFavoriteAccountLineBuilderForIWantDocument builder = new PurApFavoriteAccountLineBuilderForIWantDocument(document);
configureServicesOnBuilder(builder);
return builder;
}
use of edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument in project cu-kfs by CU-CommunityApps.
the class FavoriteAccountLineBuilderTest method testLineBuilderFailureForNonexistentLine.
/*
* Test that line creation will fail if no favorite account exists for the given ID.
*/
@Test
public void testLineBuilderFailureForNonexistentLine() throws Exception {
Integer badId = Integer.valueOf(-1);
reqsItem.setFavoriteAccountLineIdentifier(badId);
poDoc.setFavoriteAccountLineIdentifier(badId);
iwntDoc.setFavoriteAccountLineIdentifier(badId);
PurchasingFavoriteAccountLineBuilderForLineItem<RequisitionAccount> reqsBuilder = createBuilderForLineItem(reqsItem, 0, new RequisitionAccount());
PurchasingFavoriteAccountLineBuilderForDistribution<PurchaseOrderAccount> poBuilder = createBuilderForDistribution(poDoc, poAccounts, new PurchaseOrderAccount());
PurApFavoriteAccountLineBuilderForIWantDocument iwntBuilder = createBuilderForIWant(iwntDoc);
assertUnsuccessfulAccountLineCreation(reqsBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineCreation(poBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineCreation(iwntBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(reqsBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(poBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(iwntBuilder);
}
use of edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument in project cu-kfs by CU-CommunityApps.
the class FavoriteAccountLineBuilderTest method testCreateAndAddMultipleAccountLines.
/*
* Test creating and adding multiple accounting lines for distinct favorite accounts.
*/
@Test
public void testCreateAndAddMultipleAccountLines() throws Exception {
reqsItem.setFavoriteAccountLineIdentifier(TEST_FAVORITE_ACCOUNT_LINE_ID);
poDoc.setFavoriteAccountLineIdentifier(TEST_FAVORITE_ACCOUNT_LINE_ID);
iwntDoc.setFavoriteAccountLineIdentifier(TEST_FAVORITE_ACCOUNT_LINE_ID);
PurchasingFavoriteAccountLineBuilderForLineItem<RequisitionAccount> reqsBuilder = createBuilderForLineItem(reqsItem, 0, new RequisitionAccount());
PurchasingFavoriteAccountLineBuilderForDistribution<PurchaseOrderAccount> poBuilder = createBuilderForDistribution(poDoc, poAccounts, new PurchaseOrderAccount());
PurApFavoriteAccountLineBuilderForIWantDocument iwntBuilder = createBuilderForIWant(iwntDoc);
// Initial addition should succeed.
assertAccountLineAdditionToList(reqsBuilder, testFavoriteAccount, RequisitionAccount.class);
assertAccountLineAdditionToList(poBuilder, testFavoriteAccount, PurchaseOrderAccount.class);
assertAccountLineAdditionToList(iwntBuilder, testFavoriteAccount, IWantAccount.class);
// Subsequent addition for a different favorite account should also succeed.
reqsItem.setFavoriteAccountLineIdentifier(TEST_ALT_FAVORITE_ACCOUNT_LINE_ID);
poDoc.setFavoriteAccountLineIdentifier(TEST_ALT_FAVORITE_ACCOUNT_LINE_ID);
iwntDoc.setFavoriteAccountLineIdentifier(TEST_ALT_FAVORITE_ACCOUNT_LINE_ID);
assertAccountLineAdditionToList(reqsBuilder, testAltFavoriteAccount, RequisitionAccount.class);
assertAccountLineAdditionToList(poBuilder, testAltFavoriteAccount, PurchaseOrderAccount.class);
assertAccountLineAdditionToList(iwntBuilder, testAltFavoriteAccount, IWantAccount.class);
}
use of edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument in project cu-kfs by CU-CommunityApps.
the class FavoriteAccountLineBuilderTest method testLineBuilderFailureForNullLineID.
/*
* Test that a null line ID will cause line creation to fail.
*/
@Test
public void testLineBuilderFailureForNullLineID() throws Exception {
reqsItem.setFavoriteAccountLineIdentifier(null);
poDoc.setFavoriteAccountLineIdentifier(null);
iwntDoc.setFavoriteAccountLineIdentifier(null);
PurchasingFavoriteAccountLineBuilderForLineItem<RequisitionAccount> reqsBuilder = createBuilderForLineItem(reqsItem, 0, new RequisitionAccount());
PurchasingFavoriteAccountLineBuilderForDistribution<PurchaseOrderAccount> poBuilder = createBuilderForDistribution(poDoc, poAccounts, new PurchaseOrderAccount());
PurApFavoriteAccountLineBuilderForIWantDocument iwntBuilder = createBuilderForIWant(iwntDoc);
assertUnsuccessfulAccountLineCreation(reqsBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineCreation(poBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineCreation(iwntBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(reqsBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(poBuilder);
clearMessageMapErrors();
assertUnsuccessfulAccountLineAdditionToList(iwntBuilder);
}
use of edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument in project cu-kfs by CU-CommunityApps.
the class FavoriteAccountLineBuilderTest method testCreateAndAddFavoriteAccountLinesForIWant.
/*
* Test creating favorite accounting lines for use with the IWantDocument.
*/
@Test
public void testCreateAndAddFavoriteAccountLinesForIWant() throws Exception {
iwntDoc.setFavoriteAccountLineIdentifier(TEST_FAVORITE_ACCOUNT_LINE_ID);
PurApFavoriteAccountLineBuilderForIWantDocument iwntBuilder = createBuilderForIWant(iwntDoc);
assertAccountLineCreation(iwntBuilder, testFavoriteAccount, IWantAccount.class);
assertAccountLineAdditionToList(iwntBuilder, testFavoriteAccount, IWantAccount.class);
}
Aggregations