use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class PCClassLevelDomainTest method testSimple.
@Test
public void testSimple() throws PersistenceLayerException {
PCClass source = create(PCClass.class, "Source");
PCClassLevel pcl = source.getOriginalClassLevel(2);
Domain granted = create(Domain.class, "Granted");
ParseResult result = token.parseToken(context, pcl, "Granted");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(0, domainFacet.getCount(id));
classFacet.addClass(id, source);
PCClass pcc = pc.getClassKeyed(source.getKeyName());
classFacet.setLevel(id, pcc, 1);
//TODO get rid of this using facets :)
DomainApplication.addDomainsUpToLevel(source, 1, pc);
assertEquals(0, domainFacet.getCount(id));
classFacet.setLevel(id, pcc, 2);
DomainApplication.addDomainsUpToLevel(source, 2, pc);
assertTrue(domainFacet.contains(id, granted));
assertEquals(1, domainFacet.getCount(id));
DomainApplication.removeDomainsForLevel(source, 2, pc);
DomainApplication.removeDomainsForLevel(source, 1, pc);
pc.validateCharacterDomains();
classFacet.removeClass(id, source);
assertEquals(0, domainFacet.getCount(id));
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class RaceMonsterClassTest method testSimple.
@Test
public void testSimple() throws PersistenceLayerException {
TokenRegistration.register(plugin.bonustokens.Feat.class);
Race source = create(Race.class, "Source");
create(PCClass.class, "Granted").put(ObjectKey.IS_MONSTER, Boolean.TRUE);
ParseResult result = token.parseToken(context, source, "Granted:3");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(0, classFacet.getCount(id));
raceFacet.directSet(id, source, getAssoc());
assertEquals(1, classFacet.getCount(id));
assertNotNull(pc.getClassKeyed("Granted"));
raceFacet.remove(id);
assertEquals(0, classFacet.getCount(id));
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class TemplateAddLevelTest method testSimple.
@Test
public void testSimple() throws PersistenceLayerException {
PCTemplate source = create(PCTemplate.class, "Source");
create(PCClass.class, "Granted");
ParseResult result = token.parseToken(context, source, "Granted|3");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(0, classFacet.getCount(id));
templateInputFacet.directAdd(id, source, getAssoc());
assertEquals(1, classFacet.getCount(id));
assertNotNull(pc.getClassKeyed("Granted"));
templateInputFacet.remove(id, source);
assertEquals(0, classFacet.getCount(id));
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class TemplateLangbonusTest method testSimple.
@Test
public void testSimple() throws PersistenceLayerException {
PCTemplate source = create(PCTemplate.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));
templateInputFacet.directAdd(id, source, getAssoc());
assertTrue(startingLanguageFacet.contains(id, granted));
assertEquals(1, startingLanguageFacet.getCount(id));
templateInputFacet.remove(id, source);
assertEquals(0, startingLanguageFacet.getCount(id));
}
use of pcgen.rules.persistence.token.ParseResult in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method getMultYesStackYesChooseNoChoice.
public Ability getMultYesStackYesChooseNoChoice(String s) {
Ability a = create(Ability.class, s);
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
ParseResult 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_NOCHOICE_TOKEN.parseToken(context, a, null);
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
return a;
}
Aggregations