use of plugin.lsttokens.choose.LangToken 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));
}
use of plugin.lsttokens.choose.LangToken in project pcgen by PCGen.
the class AutoWeaponProfListTargetTest method testFromTemplate.
@Test
public void testFromTemplate() throws PersistenceLayerException {
PCTemplate source = create(PCTemplate.class, "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 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));
Object sel = getAssoc();
templateInputFacet.directAdd(id, source, sel);
assertTrue(containsExpected());
assertEquals(1, directAbilityFacet.getCount(id));
templateInputFacet.remove(id, source);
assertEquals(0, directAbilityFacet.getCount(id));
}
Aggregations