Search in sources :

Example 46 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceTest method isObjectCodeValid.

@Test
public void isObjectCodeValid() {
    ValidationResult validationResult = concurAccountValidationService.checkObjectCode(ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_OBJ_CD);
    Assert.assertTrue("Validation was expected to pass", validationResult.isValid());
    Assert.assertEquals("No error messages expected", 0, validationResult.getMessages().size());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 47 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceTest method isAccountingStringSubAccountInactive.

@Test
public void isAccountingStringSubAccountInactive() {
    concurAccountInfo.setSubAccountNumber(ConcurAccountValidationTestConstants.INACTIVE_SUB_ACCT);
    String subAccountErrorMessageString = ConcurConstants.AccountingStringFieldNames.SUB_ACCOUNT_NUMBER + CUKFSConstants.COLON + ConcurAccountValidationTestConstants.VALID_CHART + KFSConstants.COMMA + ConcurAccountValidationTestConstants.VALID_ACCT_NBR + KFSConstants.COMMA + ConcurAccountValidationTestConstants.INACTIVE_SUB_ACCT;
    ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("One error message was expected for inactive sub account", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), subAccountErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 48 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceTest method isSubAccountValid.

@Test
public void isSubAccountValid() {
    ValidationResult validationResult = concurAccountValidationService.checkSubAccount(ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR, ConcurAccountValidationTestConstants.VALID_SUB_ACCT);
    Assert.assertTrue("Validation was expected to pass", validationResult.isValid());
    Assert.assertEquals("No error messages expected", 0, validationResult.getMessages().size());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 49 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceTest method isProjectCodeNull.

@Test
public void isProjectCodeNull() {
    ValidationResult validationResult = concurAccountValidationService.checkProjectCode(null);
    Assert.assertTrue("Validation was expected to succeed", validationResult.isValid());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 50 with ValidationResult

use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.

the class ConcurAccountValidationServiceTest method isAccountObjectSubAccountSubObjectProjectBad.

@Test
public void isAccountObjectSubAccountSubObjectProjectBad() {
    concurAccountInfo.setAccountNumber(ConcurAccountValidationTestConstants.BAD_ACCT_NBR);
    concurAccountInfo.setSubAccountNumber(ConcurAccountValidationTestConstants.BAD_SUB_ACCT);
    concurAccountInfo.setObjectCode(ConcurAccountValidationTestConstants.BAD_OBJ_CD);
    concurAccountInfo.setSubObjectCode(ConcurAccountValidationTestConstants.BAD_SUB_OBJECT);
    concurAccountInfo.setProjectCode(ConcurAccountValidationTestConstants.BAD_PROJECT_CODE);
    String accountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.BAD_ACCT_NBR);
    ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("Error messages expected for bad account, object, sub account, sub object and project code", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), accountErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Aggregations

ValidationResult (edu.cornell.kfs.concur.businessobjects.ValidationResult)52 Test (org.junit.Test)40 ConcurAccountInfo (edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)3 ConcurBatchReportLineValidationErrorItem (edu.cornell.kfs.concur.batch.report.ConcurBatchReportLineValidationErrorItem)2 ConcurReport (edu.cornell.kfs.concur.businessobjects.ConcurReport)1 ProjectCode (org.kuali.kfs.coa.businessobject.ProjectCode)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)1