use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.
the class ConcurAccountValidationServiceTest method isChartMissing.
@Test
public void isChartMissing() {
concurAccountInfo.setChart(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 chart", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_REQUIRED), ConcurConstants.AccountingStringFieldNames.CHART) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.
the class ConcurAccountValidationServiceTest method isAccountValid.
@Test
public void isAccountValid() {
ValidationResult validationResult = concurAccountValidationService.checkAccount(ConcurAccountValidationTestConstants.VALID_CHART, ConcurAccountValidationTestConstants.VALID_ACCT_NBR);
Assert.assertTrue("Validation was expected to pass", validationResult.isValid());
Assert.assertEquals("No error messages expected", 0, validationResult.getMessages().size());
}
use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.
the class ConcurAccountValidationServiceTest method isAccountingStringProjectCodeBad.
@Test
public void isAccountingStringProjectCodeBad() {
concurAccountInfo.setProjectCode(ConcurAccountValidationTestConstants.BAD_PROJECT_CODE);
ValidationResult validationResult = concurAccountValidationService.validateConcurAccountInfo(concurAccountInfo);
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 inactive object code", MessageFormat.format(concurAccountValidationService.getConfigurationService().getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), projectCodeErrorMessageString) + KFSConstants.NEWLINE, validationResult.getErrorMessagesAsOneFormattedString());
}
use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountingExtractValidationServiceImpl method validateAccountingLine.
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) {
if (!getConcurStandardAccountingExtractCashAdvanceService().isCashAdvanceLine(line)) {
ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line);
ValidationResult validationResults = buildValidationResult(accountingInformation, false);
if (validationResults.isNotValid()) {
reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line, validationResults.getMessages()));
}
return validationResults.isValid();
} else {
LOG.debug("validateAccountingLine, found a cash advance line, no need to validate");
return true;
}
}
use of edu.cornell.kfs.concur.businessobjects.ValidationResult in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountingExtractValidationServiceImpl method buildValidationResult.
private ValidationResult buildValidationResult(ConcurAccountInfo accountingInfo, boolean isOverriddenInfo) {
ValidationResult validationResults = getConcurAccountValidationService().validateConcurAccountInfo(accountingInfo);
if (validationResults.isNotValid()) {
String overriddenOrOriginal = isOverriddenInfo ? "overridden" : "original";
String messageStarter = "buildValidationResult, the " + overriddenOrOriginal + " acounting validation results: ";
LOG.info(messageStarter + validationResults.getErrorMessagesAsOneFormattedString());
}
return validationResults;
}
Aggregations