Search in sources :

Example 31 with ParseResult

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

the class GlobalVisionTest method processToken.

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

Example 32 with ParseResult

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

the class TemplateFavoredClassTest method testDirect.

@Test
public void testDirect() throws PersistenceLayerException {
    PCTemplate source = create(PCTemplate.class, "Source");
    ParseResult result = token.parseToken(context, source, "Favorite");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
    assertEquals(baseCount(), targetFacetCount());
    templateInputFacet.directAdd(id, source, getAssoc());
    assertTrue(containsExpected());
    assertEquals(baseCount() + 1, targetFacetCount());
    templateInputFacet.remove(id, source);
    assertEquals(baseCount(), targetFacetCount());
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Example 33 with ParseResult

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

the class GlobalCSkillTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = 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 34 with ParseResult

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

the class GlobalCSkillTest method testList.

@Test
public void testList() throws PersistenceLayerException {
    PCTemplate source = create(PCTemplate.class, "Source");
    ParseResult result = token.parseToken(context, source, "LIST");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    result = CHOOSE_SKILL_TOKEN.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    PCClass wizard = create(PCClass.class, "Wizard");
    finishLoad();
    pc.incrementClassLevel(1, wizard);
    assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, wizard));
    templateInputFacet.directAdd(id, source, granted);
    pc.calcActiveBonuses();
    assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, wizard));
    assertTrue(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
    templateInputFacet.remove(id, source);
    pc.calcActiveBonuses();
    assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) PCTemplate(pcgen.core.PCTemplate) PCClass(pcgen.core.PCClass) Test(org.junit.Test) AbstractContentTokenTest(tokencontent.testsupport.AbstractContentTokenTest)

Example 35 with ParseResult

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

the class GlobalCcSkillTest method processToken.

@Override
public void processToken(CDOMObject source) {
    ParseResult result = token.parseToken(context, source, "Granted");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    finishLoad();
}
Also used : 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