/** * Validates that isActiveKemId returns false when the KEMID is closed (closed indicator is true). */ public void testIsActiveKemId_False() { KEMID kemid = KemIdFixture.CLOSED_KEMID_RECORD.createKemidRecord(); EndowmentTransactionLine endowmentTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_INCOME .createEndowmentTransactionLine(false); assertFalse( rule.isActiveKemId( endowmentTransactionLine, rule.getErrorPrefix(endowmentTransactionLine, -1))); }
/** * Validates that validateKemId returns false when the kemid on the transaction line does not * exist in the db. */ public void testValidateKemId_False() { EndowmentTransactionLine endowmentTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_INCOME .createEndowmentTransactionLine(false); endowmentTransactionLine.setKemid(EndowTestConstants.INVALID_KEMID); assertFalse( rule.validateKemId( endowmentTransactionLine, rule.getErrorPrefix(endowmentTransactionLine, -1))); }
/** * Validates that validateKemId returns true when the kemid on the transaction line exists in the * db. */ public void testValidateKemId_True() { KEMID kemid = KemIdFixture.OPEN_KEMID_RECORD.createKemidRecord(); EndowmentTransactionLine endowmentTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_INCOME .createEndowmentTransactionLine(false); assertTrue( rule.validateKemId( endowmentTransactionLine, rule.getErrorPrefix(endowmentTransactionLine, -1))); }
/** * Validates that validateTransactionAmountGreaterThanZero returns true when transaction amount is * greater than zero. */ public void testTransactionsLineAmountPositive_True() { EndowmentTransactionLine endowmentTargetTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_POSITIVE_AMT .createEndowmentTransactionLine(false); assertTrue( rule.validateTransactionAmountGreaterThanZero( endowmentTargetTransactionLine, rule.getErrorPrefix(endowmentTargetTransactionLine, -1))); }
/** * Validates that validateTransactionUnitsGreaterThanZero returns false when transaction units is * zero. */ public void testTransactionUnitsPositive_False() { EndowmentTransactionLine endowmentTargetTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_ZERO_UNITS .createEndowmentTransactionLine(false); assertFalse( rule.validateTransactionUnitsGreaterThanZero( endowmentTargetTransactionLine, rule.getErrorPrefix(endowmentTargetTransactionLine, -1))); }
/** * Validates that canKEMIDHaveAPrincipalTransaction returns false when the transaction line IP * indicator is P and the principal restriction code is NA. */ public void testKemidPrincRestrNotNAWhenTransLinePrincipal_False() { EndowmentTransactionLine endowmentTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_PRINCIPAL .createEndowmentTransactionLine(false); KEMID kemid = KemIdFixture.NA_PRINC_RESTR_KEMID_RECORD.createKemidRecord(); endowmentTransactionLine.setKemid(kemid.getKemid()); endowmentTransactionLine.setKemidObj(kemid); assertFalse( rule.canKEMIDHaveAPrincipalTransaction( endowmentTransactionLine, rule.getErrorPrefix(endowmentTransactionLine, -1))); }
/** * Validates that validateNoTransactionRestriction returns true when the KEMID has a transaction * restriction code different from NTRAN. */ public void testTransactionsNotAllowedForNTRANKemid_True() { KEMID ntranKemid = KemIdFixture.ALLOW_TRAN_KEMID_RECORD.createKemidRecord(); EndowmentTargetTransactionLine endowmentTargetTransactionLine = new EndowmentTargetTransactionLine(); endowmentTargetTransactionLine.setKemid(ntranKemid.getKemid()); endowmentTargetTransactionLine.setKemidObj(ntranKemid); assertTrue( rule.validateNoTransactionRestriction( endowmentTargetTransactionLine, rule.getErrorPrefix(endowmentTargetTransactionLine, -1))); }
/** * Validates that the validateTaxLotsCostAndTransactionAmountLessOrEqualToSecurityCommitment * returns false when the SECURITY_ID has a class code type of A (Alternative Investments), and * the total END_HLDG_TAX_LOT_T: HLDG_COST for the SECURITY_ID plus the END_TRAN_LN_T: TRAN_AMT * exceeds the value in END_SEC_T: CMTMNT_AMT for the Security */ public void testValidateTaxLotsCostAndTransactionAmountLessOrEqualToSecurityCommitment_False() { KEMID kemid = KemIdFixture.OPEN_KEMID_RECORD.createKemidRecord(); // need to insert into END_HLDG_TAX_LOT_REBAL_T TABLE because of constraints.... HoldingTaxLotRebalanceFixture.HOLDING_TAX_LOT_REBALANCE_RECORD .createHoldingTaxLotRebalanceRecord(); HoldingTaxLot holdingTaxLot = HoldingTaxLotFixture.HOLDING_TAX_LOT_RECORD.createHoldingTaxLotRecord(); SecurityReportingGroup reportingGroup = SecurityReportingGroupFixture.REPORTING_GROUP.createSecurityReportingGroup(); EndowmentTransactionCode endowmentTransactionCode = EndowmentTransactionCodeFixture.INCOME_TRANSACTION_CODE.createEndowmentTransactionCode(); ClassCode classCode = ClassCodeFixture.ALTERNATIVE_INVESTMENT_CLASS_CODE.createClassCodeRecord(); Security security = SecurityFixture.ALTERNATIVE_INVEST_ACTIVE_SECURITY.createSecurityRecord(); security.setCommitmentAmount(BigDecimal.ZERO); document.getTargetTransactionSecurity().setSecurityID(security.getId()); document.getTargetTransactionSecurity().setSecurity(security); EndowmentTransactionLine endowmentTargetTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_POSITIVE_AMT .createEndowmentTransactionLine(false); document.addTargetTransactionLine( (EndowmentTargetTransactionLine) endowmentTargetTransactionLine); assetIncreaseDocumentTaxLotsService.updateTransactionLineTaxLots( document, endowmentTargetTransactionLine); assertFalse( rule.validateTaxLotsCostAndTransactionAmountLessOrEqualToSecurityCommitment(document)); }
/** * Validates that validateEndowmentTransactionTypeCode returns false when the etran code type is * not income or expense. */ public void testEtranCodeIncomeOrExpense_False() { EndowmentTransactionLine endowmentTargetTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_POSITIVE_AMT .createEndowmentTransactionLine(false); EndowmentTransactionCode endowmentTransactionCode = EndowmentTransactionCodeFixture.ASSET_TRANSACTION_CODE.createEndowmentTransactionCode(); endowmentTargetTransactionLine.setEtranCode(endowmentTransactionCode.getCode()); endowmentTargetTransactionLine.setEtranCodeObj(endowmentTransactionCode); assertFalse( rule.validateEndowmentTransactionTypeCode( document, endowmentTargetTransactionLine, rule.getErrorPrefix(endowmentTargetTransactionLine, -1))); }
/** * Validates that transactionLineSizeGreaterThanZero returns true if the document has at least one * target transaction line. */ public void testDocumentHasAtLeastOneTransactionLine_True() { EndowmentTransactionLine endowmentTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_INCOME .createEndowmentTransactionLine(false); document.addTargetTransactionLine((EndowmentTargetTransactionLine) endowmentTransactionLine); assertTrue(rule.transactionLineSizeGreaterThanZero(document, false)); }
/** Validates that validateSecurityCode returns false when an invalid security is set. */ public void testValidateSecurity_False() { EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setSecurityID(EndowTestConstants.INVALID_SECURITY_ID); document.setTargetTransactionSecurity(targetTransactionSecurity); assertFalse(rule.validateSecurityCode(document, false)); }
/** * Validates that validateRegistrationCode returns false when a valid registration code is set. */ public void testValidateRegistration_False() { EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setRegistrationCode(EndowTestConstants.INVALID_REGISTRATION_CODE); document.setTargetTransactionSecurity(targetTransactionSecurity); assertFalse(rule.validateRegistrationCode(document, true)); }
/** * Validates that validateChartMatch returns false when etran code gl chart does not match the * chart for KEMID general ledger account. */ public void testKemidEtranCodeMatch_False() { EndowmentTransactionLine endowmentTargetTransactionLine = EndowmentTransactionLineFixture.ENDOWMENT_TRANSACTIONAL_LINE_INCOME .createEndowmentTransactionLine(false); EndowmentTransactionCode endowmentTransactionCode = EndowmentTransactionCodeFixture.INCOME_TRANSACTION_CODE.createEndowmentTransactionCode(); KEMID kemid = KemIdFixture.OPEN_KEMID_RECORD.createKemidRecord(); GLLink glLink = GLLinkFixture.GL_LINK_UA_CHART.createGLLink(); KemidGeneralLedgerAccount generalLedgerAccount = KemidGeneralLedgerAccountFixture.KEMID_GL_ACCOUNT.createKemidGeneralLedgerAccount(); kemid.getKemidGeneralLedgerAccounts().add(generalLedgerAccount); endowmentTransactionCode.getGlLinks().add(glLink); endowmentTargetTransactionLine.setKemid(kemid.getKemid()); endowmentTargetTransactionLine.setKemidObj(kemid); endowmentTargetTransactionLine.setEtranCode(endowmentTransactionCode.getCode()); endowmentTargetTransactionLine.setEtranCodeObj(endowmentTransactionCode); assertFalse( rule.validateChartMatch( endowmentTargetTransactionLine, rule.getErrorPrefix(endowmentTargetTransactionLine, -1))); }
/** Validates that validateRegistrationCode returns true when a valid registration code is set. */ public void testValidateRegistration_True() { // add security details RegistrationCode registrationCode = RegistrationCodeFixture.REGISTRATION_CODE_RECORD.createRegistrationCode(); EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setRegistrationCode(registrationCode.getCode()); targetTransactionSecurity.setRegistrationCodeObj(registrationCode); document.setTargetTransactionSecurity(targetTransactionSecurity); assertTrue(rule.validateRegistrationCode(document, false)); }
/** Validates that isSecurityActive returns false when an inactive security is added. */ public void testActiveSecurity_False() { // add security details SecurityReportingGroup reportingGroup = SecurityReportingGroupFixture.REPORTING_GROUP.createSecurityReportingGroup(); EndowmentTransactionCode endowmentTransactionCode = EndowmentTransactionCodeFixture.INCOME_TRANSACTION_CODE.createEndowmentTransactionCode(); ClassCode classCode = ClassCodeFixture.LIABILITY_CLASS_CODE.createClassCodeRecord(); Security security = SecurityFixture.INACTIVE_SECURITY.createSecurityRecord(); EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setSecurityID(security.getId()); targetTransactionSecurity.setSecurity(security); document.setTargetTransactionSecurity(targetTransactionSecurity); assertFalse(rule.isSecurityActive(document, false)); }
/** * Validates that validateSecurityClassCodeTypeNotLiability returns true when a security with a * class code other that Liability is added. */ public void testLiabilityClassCode_True() { // add security details SecurityReportingGroup reportingGroup = SecurityReportingGroupFixture.REPORTING_GROUP.createSecurityReportingGroup(); EndowmentTransactionCode endowmentTransactionCode = EndowmentTransactionCodeFixture.INCOME_TRANSACTION_CODE.createEndowmentTransactionCode(); ClassCode classCode = ClassCodeFixture.NOT_LIABILITY_CLASS_CODE.createClassCodeRecord(); Security security = SecurityFixture.ACTIVE_SECURITY.createSecurityRecord(); security.setClassCode(classCode); security.setSecurityClassCode(classCode.getCode()); EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setSecurityID(security.getId()); targetTransactionSecurity.setSecurity(security); document.getTargetTransactionSecurities().add(targetTransactionSecurity); assertTrue(rule.validateSecurityClassCodeTypeNotLiability(document, false)); }
/** * Validates that transactionLineSizeGreaterThanZero returns false if the document has no target * transaction lines. */ public void testDocumentHasAtLeastOneTransactionLine_False() { assertFalse(rule.transactionLineSizeGreaterThanZero(document, false)); }