/** 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 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));
  }