Search in sources :

Example 41 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isAccountNumberMissing.

@Test
public void isAccountNumberMissing() {
    concurAccountInfo.setAccountNumber(null);
    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 missing account", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 42 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isAccountingStringChartBad.

@Test
public void isAccountingStringChartBad() {
    concurAccountInfo.setChart(ConcurAccountValidationTestConstants.BAD_CHART);
    ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
    String accountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER, ConcurAccountValidationTestConstants.BAD_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("One error message was expected for bad chart", 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)

Example 43 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isObjectCodeMissing.

@Test
public void isObjectCodeMissing() {
    concurAccountInfo.setObjectCode(null);
    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 missing object code", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.OBJECT_CODE) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 44 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isAccountingStringSubObjectCodeBad.

@Test
public void isAccountingStringSubObjectCodeBad() {
    concurAccountInfo.setSubObjectCode(ConcurAccountValidationTestConstants.BAD_SUB_OBJECT);
    ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
    String subObjectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.SUB_OBJECT_CODE, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR, ConcurAccountValidationTestConstants.VALID_OBJ_CD, ConcurAccountValidationTestConstants.BAD_SUB_OBJECT);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("Error messages expected for bad sub object code", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), subObjectCodeErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
Also used : ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult) Test(org.junit.Test)

Example 45 with ValidationResult

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

the class ConcurAccountValidationServiceTest method isObjectSubAccountSubObjectProjectBad.

@Test
public void isObjectSubAccountSubObjectProjectBad() {
    concurAccountInfo.setSubAccountNumber(ConcurAccountValidationTestConstants.BAD_SUB_ACCT);
    concurAccountInfo.setObjectCode(ConcurAccountValidationTestConstants.BAD_OBJ_CD);
    concurAccountInfo.setSubObjectCode(ConcurAccountValidationTestConstants.BAD_SUB_OBJECT);
    concurAccountInfo.setProjectCode(ConcurAccountValidationTestConstants.BAD_PROJECT_CODE);
    ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
    String objectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.OBJECT_CODE, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.BAD_OBJ_CD);
    String subAccountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.SUB_ACCOUNT_NUMBER, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR, ConcurAccountValidationTestConstants.BAD_SUB_ACCT);
    String subObjectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.SUB_OBJECT_CODE, ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR, ConcurAccountValidationTestConstants.BAD_OBJ_CD, ConcurAccountValidationTestConstants.BAD_SUB_OBJECT);
    String projectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.PROJECT_CODE, ConcurAccountValidationTestConstants.BAD_PROJECT_CODE);
    Assert.assertFalse("Validation was expected to fail but returned true", validationResult.isValid());
    Assert.assertEquals("Error messages expected for bad  object, sub account, sub object and project code", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), objectCodeErrorMessageString) + KFSConstants.NEWLINE + MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), subAccountErrorMessageString) + KFSConstants.NEWLINE + MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), subObjectCodeErrorMessageString) + KFSConstants.NEWLINE + MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), projectCodeErrorMessageString) + 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