/** Validates that isSecurityActive returns true when an active security is added. */ public void testActiveSecurity_True() { // 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.ACTIVE_SECURITY.createSecurityRecord(); EndowmentTargetTransactionSecurity targetTransactionSecurity = new EndowmentTargetTransactionSecurity(); targetTransactionSecurity.setSecurityID(security.getId()); targetTransactionSecurity.setSecurity(security); document.setTargetTransactionSecurity(targetTransactionSecurity); assertTrue(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)); }