Search in sources :

Example 1 with TestPayeeAchIdTypeValuesFinder

use of edu.cornell.kfs.pdp.businessobject.options.TestPayeeAchIdTypeValuesFinder in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccountExtractServiceImplTest method createMockDataDictionaryService.

private DataDictionaryService createMockDataDictionaryService() throws Exception {
    final String PAYEE_ACH_ACCOUNT_CLASSNAME = PayeeACHAccount.class.getName();
    final String DOCUMENT_HEADER_CLASSNAME = DocumentHeader.class.getName();
    /*
         * Only a few specific attribute definitions should be masked or have values finders; the rest
         * should be plain. Also, we only care about the max lengths of a few specific properties.
         */
    DataDictionaryService ddService = mock(DataDictionaryService.class);
    AttributeDefinition maskedAttribute = createMaskedAttributeDefinition();
    AttributeDefinition unmaskedAttribute = createUnmaskedAttributeDefinition();
    AttributeDefinition payeeIdTypeAttribute = createAttributeDefinitionWithValuesFinder(new TestPayeeAchIdTypeValuesFinder(), false);
    AttributeDefinition bankAccountTypeAttribute = createAttributeDefinitionWithValuesFinder(new CuCheckingSavingsValuesFinder(), true);
    when(ddService.getAttributeDefinition(PAYEE_ACH_ACCOUNT_CLASSNAME, PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE)).thenReturn(payeeIdTypeAttribute);
    when(ddService.getAttributeDefinition(PAYEE_ACH_ACCOUNT_CLASSNAME, PdpPropertyConstants.PAYEE_ID_NUMBER)).thenReturn(unmaskedAttribute);
    when(ddService.getAttributeDefinition(PAYEE_ACH_ACCOUNT_CLASSNAME, CUPdpPropertyConstants.BANK_ACCOUNT_TYPE_CODE)).thenReturn(bankAccountTypeAttribute);
    when(ddService.getAttributeDefinition(PAYEE_ACH_ACCOUNT_CLASSNAME, CUPdpPropertyConstants.PAYEE_ACH_BANK_NAME)).thenReturn(maskedAttribute);
    when(ddService.getAttributeDefinition(PAYEE_ACH_ACCOUNT_CLASSNAME, KFSPropertyConstants.BANK_ACCOUNT_NUMBER)).thenReturn(maskedAttribute);
    when(ddService.getAttributeMaxLength(DOCUMENT_HEADER_CLASSNAME, KRADPropertyConstants.DOCUMENT_DESCRIPTION)).thenReturn(DOCUMENT_DESCRIPTION_MAX_LENGTH);
    return ddService;
}
Also used : CuCheckingSavingsValuesFinder(edu.cornell.kfs.coa.businessobject.options.CuCheckingSavingsValuesFinder) AttributeDefinition(org.kuali.kfs.krad.datadictionary.AttributeDefinition) TestPayeeAchIdTypeValuesFinder(edu.cornell.kfs.pdp.businessobject.options.TestPayeeAchIdTypeValuesFinder) DataDictionaryService(org.kuali.kfs.datadictionary.legacy.DataDictionaryService)

Example 2 with TestPayeeAchIdTypeValuesFinder

use of edu.cornell.kfs.pdp.businessobject.options.TestPayeeAchIdTypeValuesFinder in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccountExtractServiceImplTest method testEmailBodyPlaceholderResolution.

@Test
public void testEmailBodyPlaceholderResolution() throws Exception {
    // NOTE: We expect that all potentially-sensitive placeholders except bank name will be replaced with empty text.
    TestPayeeAchIdTypeValuesFinder payeeIdTypeKeyValues = new TestPayeeAchIdTypeValuesFinder();
    PayeeACHAccount achAccount = PayeeACHAccountFixture.JANE_DOE_SAVINGS_ACCOUNT_EMPLOYEE_NEW.toPayeeACHAccount();
    String expectedPayeeIdTypeLabel = payeeIdTypeKeyValues.getKeyLabel(achAccount.getPayeeIdentifierTypeCode());
    String expectedBody = MessageFormat.format(EMAIL_STRING_AS_FORMAT, expectedPayeeIdTypeLabel, achAccount.getPayeeIdNumber(), PERSONAL_SAVINGS_ACCOUNT_TYPE_LABEL, achAccount.getBankRouting().getBankName());
    PayeeACHAccountDocumentServiceImpl payeeDocumentService = (PayeeACHAccountDocumentServiceImpl) payeeACHAccountExtractService.payeeACHAccountDocumentService;
    String actualBody = payeeDocumentService.getResolvedEmailBody(achAccount, UNRESOLVED_EMAIL_STRING);
    assertEquals("Email body placeholders and special characters were not resolved properly", expectedBody, actualBody);
}
Also used : PayeeACHAccount(org.kuali.kfs.pdp.businessobject.PayeeACHAccount) TestPayeeAchIdTypeValuesFinder(edu.cornell.kfs.pdp.businessobject.options.TestPayeeAchIdTypeValuesFinder) Test(org.junit.Test)

Aggregations

TestPayeeAchIdTypeValuesFinder (edu.cornell.kfs.pdp.businessobject.options.TestPayeeAchIdTypeValuesFinder)2 CuCheckingSavingsValuesFinder (edu.cornell.kfs.coa.businessobject.options.CuCheckingSavingsValuesFinder)1 Test (org.junit.Test)1 DataDictionaryService (org.kuali.kfs.datadictionary.legacy.DataDictionaryService)1 AttributeDefinition (org.kuali.kfs.krad.datadictionary.AttributeDefinition)1 PayeeACHAccount (org.kuali.kfs.pdp.businessobject.PayeeACHAccount)1