/**
   * Test to ensure that a character will fail a test if it does not have the correct number of
   * levels in the class.
   *
   * @throws Exception
   */
  public void testCharWithMultipleSpellClasses() throws Exception {
    LoadContext context = Globals.getContext();
    final PCClass pcClass = new PCClass();
    pcClass.setName("MyClass");
    context.unconditionallyProcess(pcClass, "SPELLSTAT", "CHA");
    pcClass.put(StringKey.SPELLTYPE, "ARCANE");
    context.unconditionallyProcess(pcClass.getOriginalClassLevel(1), "CAST", "5,4");

    final PCClass pcClass2 = new PCClass();
    pcClass2.setName("Other Class");
    context.unconditionallyProcess(pcClass2, "SPELLSTAT", "INT");
    pcClass2.put(StringKey.SPELLTYPE, "ARCANE");
    context.unconditionallyProcess(pcClass2.getOriginalClassLevel(1), "CAST", "5,4");

    final PlayerCharacter character = getCharacter();
    setPCStat(character, cha, 12);
    setPCStat(character, intel, 12);
    character.incrementClassLevel(1, pcClass);
    character.incrementClassLevel(2, pcClass2);

    final PreClassParser producer = new PreClassParser();

    final Prerequisite prereq =
        producer.parse("CLASS", "1,SPELLCASTER.Arcane,SPELLCASTER.Arcane=2", false, false);

    final PreMult test = new PreMult();
    final int passes = test.passes(prereq, character, null);
    assertEquals(1, passes);
  }
  /**
   * Test to ensure that a number of feat test will correctly require a number of separate feats in
   * any combination of two types.
   *
   * @throws Exception
   */
  public void testMultiFeats() throws Exception {
    final Ability metamagic1 = new Ability();
    metamagic1.addToListFor(ListKey.TYPE, Type.getConstant("METAMAGIC"));
    metamagic1.setName("MM1");
    metamagic1.put(StringKey.KEY_NAME, "MM1");
    metamagic1.setCDOMCategory(AbilityCategory.FEAT);

    final Ability metamagic2 = new Ability();
    metamagic2.addToListFor(ListKey.TYPE, Type.getConstant("METAMAGIC"));
    metamagic2.setName("MM2");
    metamagic2.put(StringKey.KEY_NAME, "MM2");
    metamagic2.setCDOMCategory(AbilityCategory.FEAT);

    final Ability metamagic3 = new Ability();
    metamagic3.addToListFor(ListKey.TYPE, Type.getConstant("METAMAGIC"));
    metamagic3.setName("MM3");
    metamagic3.put(StringKey.KEY_NAME, "MM3");
    metamagic3.setCDOMCategory(AbilityCategory.FEAT);

    final Ability item1 = new Ability();
    item1.addToListFor(ListKey.TYPE, Type.getConstant("ItemCreation"));
    item1.setName("IC1");
    item1.put(StringKey.KEY_NAME, "IC1");
    item1.setCDOMCategory(AbilityCategory.FEAT);

    final Ability item2 = new Ability();
    item2.addToListFor(ListKey.TYPE, Type.getConstant("ItemCreation"));
    item2.setName("IC2");
    item2.put(StringKey.KEY_NAME, "IC2");
    item2.setCDOMCategory(AbilityCategory.FEAT);

    final Ability item3 = new Ability();
    item3.addToListFor(ListKey.TYPE, Type.getConstant("ItemCreation"));
    item3.setName("IC3");
    item3.put(StringKey.KEY_NAME, "IC3");
    item3.setCDOMCategory(AbilityCategory.FEAT);

    final PlayerCharacter character = getCharacter();

    final PreFeatParser producer = new PreFeatParser();

    final Prerequisite prereq =
        producer.parse("FEAT", "3,TYPE=Metamagic,TYPE=ItemCreation", false, false);

    final PreMult test = new PreMult();
    int passes = test.passes(prereq, character, null);
    assertEquals("No feats should not pass", 0, passes);

    character.addAbilityNeedCheck(AbilityCategory.FEAT, metamagic1);
    passes = test.passes(prereq, character, null);
    assertEquals("One feat should not pass", 0, passes);

    character.addAbilityNeedCheck(AbilityCategory.FEAT, metamagic2);
    passes = test.passes(prereq, character, null);
    assertEquals("Two feats should not pass", 0, passes);

    character.addAbilityNeedCheck(AbilityCategory.FEAT, metamagic3);
    passes = test.passes(prereq, character, null);
    assertEquals("Three feats should pass", 1, passes);

    character.removeRealAbility(AbilityCategory.FEAT, metamagic3);
    character.addAbilityNeedCheck(AbilityCategory.FEAT, item1);
    passes = test.passes(prereq, character, null);
    assertEquals("Three feats should pass", 1, passes);

    character.addAbilityNeedCheck(AbilityCategory.FEAT, item2);
    character.addAbilityNeedCheck(AbilityCategory.FEAT, item3);
    character.addAbilityNeedCheck(AbilityCategory.FEAT, metamagic3);
    passes = test.passes(prereq, character, null);
    assertEquals("Six feats should pass", 1, passes);

    character.removeRealAbility(AbilityCategory.FEAT, metamagic3);
    character.removeRealAbility(AbilityCategory.FEAT, item3);
    character.removeRealAbility(AbilityCategory.FEAT, item2);
    character.removeRealAbility(AbilityCategory.FEAT, item1);
    character.removeRealAbility(AbilityCategory.FEAT, metamagic2);
    character.removeRealAbility(AbilityCategory.FEAT, metamagic1);
  }