Search in sources :

Example 1 with PurApFavoriteAccountLineBuilderForIWantDocument

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;
}
Also used : PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)

Example 2 with PurApFavoriteAccountLineBuilderForIWantDocument

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);
}
Also used : RequisitionAccount(org.kuali.kfs.module.purap.businessobject.RequisitionAccount) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument) PurchaseOrderAccount(org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount) Test(org.junit.Test)

Example 3 with PurApFavoriteAccountLineBuilderForIWantDocument

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);
}
Also used : RequisitionAccount(org.kuali.kfs.module.purap.businessobject.RequisitionAccount) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument) PurchaseOrderAccount(org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount) Test(org.junit.Test)

Example 4 with PurApFavoriteAccountLineBuilderForIWantDocument

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);
}
Also used : RequisitionAccount(org.kuali.kfs.module.purap.businessobject.RequisitionAccount) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument) PurchaseOrderAccount(org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount) Test(org.junit.Test)

Example 5 with PurApFavoriteAccountLineBuilderForIWantDocument

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);
}
Also used : PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument) Test(org.junit.Test)

Aggregations

PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)7 Test (org.junit.Test)5 PurchaseOrderAccount (org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount)4 RequisitionAccount (org.kuali.kfs.module.purap.businessobject.RequisitionAccount)4