Search in sources :

Example 6 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class AutoArmorProfTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = AUTO_ARMORPROF_TOKEN.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 7 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class AutoLangTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = AUTO_LANG_TOKEN.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 8 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class AutoWeaponProfListTargetTest method testFromAbility.

@Test
public void testFromAbility() throws PersistenceLayerException {
    Ability source = create(Ability.class, "Source");
    context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, source);
    Ability granted = createGrantedObject();
    context.getReferenceContext().constructCDOMObject(Language.class, "English");
    ParseResult result = new MultToken().parseToken(context, granted, "YES");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = new MultToken().parseToken(context, source, "YES");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = new LangToken().parseToken(context, granted, "ALL");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = new LangToken().parseToken(context, source, "ALL");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = token.parseToken(context, source, "FEAT|Granted (%LIST)");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
    assertEquals(0, directAbilityFacet.getCount(id));
    CNAbilitySelection cas = new CNAbilitySelection(CNAbilityFactory.getCNAbility(AbilityCategory.FEAT, Nature.AUTOMATIC, source), "English");
    directAbilityFacet.add(id, cas, UserSelection.getInstance());
    assertTrue(containsExpected());
    assertEquals(2, directAbilityFacet.getCount(id));
    directAbilityFacet.remove(id, cas, UserSelection.getInstance());
    assertEquals(0, directAbilityFacet.getCount(id));
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) ParseResult(pcgen.rules.persistence.token.ParseResult) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) MultToken(plugin.lsttokens.ability.MultToken) LangToken(plugin.lsttokens.choose.LangToken) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Example 9 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class AutoWeaponProfTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = AUTO_WEAPONPROF_TOKEN.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 10 with ParseResult

use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.

the class AbstractAbilityGrantCheckTest method getMultNo.

public Ability getMultNo(String s) {
    Ability a = create(Ability.class, s);
    context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
    ParseResult result = TYPE_TOKEN.parseToken(context, a, "Selectable");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    return a;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) ParseResult(pcgen.rules.persistence.token.ParseResult)

Aggregations

ParseResult (pcgen.rules.persistence.token.ParseResult)210 StringTokenizer (java.util.StringTokenizer)68 Test (org.junit.Test)45 CDOMReference (pcgen.cdom.base.CDOMReference)30 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)26 Ability (pcgen.core.Ability)21 ArrayList (java.util.ArrayList)18 Formula (pcgen.base.formula.Formula)18 ParsingSeparator (pcgen.base.text.ParsingSeparator)18 Prerequisite (pcgen.core.prereq.Prerequisite)18 PCClass (pcgen.core.PCClass)17 Ungranted (pcgen.cdom.base.Ungranted)15 PCTemplate (pcgen.core.PCTemplate)14 CNAbility (pcgen.cdom.content.CNAbility)13 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)11 ComplexParseResult (pcgen.rules.persistence.token.ComplexParseResult)11 BigDecimal (java.math.BigDecimal)10 Race (pcgen.core.Race)10 ConcretePersistentTransitionChoice (pcgen.cdom.base.ConcretePersistentTransitionChoice)9 LegalScope (pcgen.base.formula.base.LegalScope)8