use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method getMultYesStackYes.
public Ability getMultYesStackYes(String s, String target) {
Ability a = create(Ability.class, s);
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
ParseResult result = AUTO_FEAT_TOKEN.parseToken(context, a, "FEAT|%LIST");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = ABILITY_MULT_TOKEN.parseToken(context, a, "YES");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = ABILITY_STACK_TOKEN.parseToken(context, a, "YES");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = CHOOSE_FEATSELECTION_TOKEN.parseToken(context, a, target);
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
return a;
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class GlobalAbilityTest method processToken.
@Override
public void processToken(CDOMObject source) {
ParseResult result = token.parseToken(context, source, "FEAT|VIRTUAL|Granted");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class PCClassLangbonusTest method testSimple.
@Test
public void testSimple() throws PersistenceLayerException {
PCClass source = create(PCClass.class, "Source");
Language granted = create(Language.class, "Granted");
ParseResult result = token.parseToken(context, source, "Granted");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(0, startingLanguageFacet.getCount(id));
classFacet.addClass(id, source);
assertTrue(startingLanguageFacet.contains(id, granted));
assertEquals(1, startingLanguageFacet.getCount(id));
classFacet.removeClass(id, source);
assertEquals(0, startingLanguageFacet.getCount(id));
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class GlobalTemplateTest 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();
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class SpellClassesTest method testDirect.
@Test
public void testDirect() throws PersistenceLayerException {
ParseResult result = token.parseToken(context, sp, "Dragon=1");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
classFacet.addClass(id, dragon);
classFacet.setLevel(id, dragon, 1);
//Right now this is done in PCClass
FacetLibrary.getFacet(SpellListFacet.class).add(id, dragon.get(ObjectKey.CLASS_SPELLLIST), dragon);
pc.setDirty(true);
HashMapToList<CDOMList<Spell>, Integer> map = availableSpellFacet.getSpellLevelInfo(id, sp);
assertTrue(map.containsListFor(dragon.get(ObjectKey.CLASS_SPELLLIST)));
assertEquals(1, map.getListFor(dragon.get(ObjectKey.CLASS_SPELLLIST)).size());
assertEquals(1, map.getListFor(dragon.get(ObjectKey.CLASS_SPELLLIST)).get(0).intValue());
}
Aggregations