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