use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class SpellDomainsTest method testDirect.
@Test
public void testDirect() throws PersistenceLayerException {
ParseResult result = token.parseToken(context, sp, "Source=1");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
classFacet.addClass(id, dragon);
classFacet.setLevel(id, dragon, 1);
domainInputFacet.add(id, domain, new ClassSource(dragon, 0));
pc.setDirty(true);
HashMapToList<CDOMList<Spell>, Integer> map = availableSpellFacet.getSpellLevelInfo(id, sp);
assertTrue(map.containsListFor(domain.get(ObjectKey.DOMAIN_SPELLLIST)));
assertEquals(1, map.getListFor(domain.get(ObjectKey.DOMAIN_SPELLLIST)).size());
assertEquals(1, map.getListFor(domain.get(ObjectKey.DOMAIN_SPELLLIST)).get(0).intValue());
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class TemplateFavoredClassTest 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_CLASS_TOKEN.parseToken(context, source, "Favorite");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(baseCount(), targetFacetCount());
templateInputFacet.add(id, source);
assertTrue(containsExpected());
assertEquals(baseCount() + 1, targetFacetCount());
templateInputFacet.remove(id, source);
assertEquals(baseCount(), targetFacetCount());
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class AddTargetedAbilityNormalTest method createGrantedObject.
@Override
protected Ability createGrantedObject() {
context.getReferenceContext().constructCDOMObject(Language.class, "English");
Ability a = super.createGrantedObject();
ParseResult result = AUTO_LANG_TOKEN.parseToken(context, a, "%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 = CHOOSE_LANG_TOKEN.parseToken(context, a, "ALL");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
return a;
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class AddTargetedAbilityVirtualTest method createGrantedObject.
@Override
protected Ability createGrantedObject() {
context.getReferenceContext().constructCDOMObject(Language.class, "English");
Ability a = super.createGrantedObject();
ParseResult result = AUTO_LANG_TOKEN.parseToken(context, a, "%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 = CHOOSE_LANG_TOKEN.parseToken(context, a, "ALL");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
return a;
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class GlobalQualifyTest method testFromCompanionMod.
@Override
@Test
public void testFromCompanionMod() throws PersistenceLayerException {
CompanionMod source = create(CompanionMod.class, "Source");
ParseResult result = token.parseToken(context, source, "RACE|Dwarf");
assertFalse(result.passed());
}
Aggregations