use of plugin.pretokens.parser.PreClassLevelMaxParser in project pcgen by PCGen.
the class PreClassTest method testPreClassLevelMax.
/**
* Test the PRE CLASSLEVELMAX token
* @throws Exception
*/
public void testPreClassLevelMax() throws Exception {
final PreClassLevelMaxParser parser = new PreClassLevelMaxParser();
final Prerequisite prereq = parser.parse("CLASSLEVELMAX", "1,Monk=1", false, false);
final Prerequisite dualPrereq = parser.parse("CLASSLEVELMAX", "2,Monk=1,Fighter=1", false, false);
final Prerequisite singlePrereq = parser.parse("CLASSLEVELMAX", "1,Monk=1,Fighter=1", false, false);
final PlayerCharacter character = getCharacter();
assertTrue("Should pass with no levels", PrereqHandler.passes(prereq, character, null));
assertTrue("Should pass with no levels of either", PrereqHandler.passes(dualPrereq, character, null));
final PCClass pcClass = new PCClass();
pcClass.setName("Monk");
character.incrementClassLevel(1, pcClass);
assertTrue("Should pass with 1 level", PrereqHandler.passes(prereq, character, null));
assertTrue("Should pass with 1 level of one", PrereqHandler.passes(dualPrereq, character, null));
final PCClass ftrClass = new PCClass();
ftrClass.setName("Fighter");
character.incrementClassLevel(1, ftrClass);
assertTrue("Should pass with 1 level of each", PrereqHandler.passes(dualPrereq, character, null));
character.incrementClassLevel(1, pcClass);
assertFalse("Should not pass with 2 levels", PrereqHandler.passes(prereq, character, null));
assertFalse("Should not pass with 2 levels of one", PrereqHandler.passes(dualPrereq, character, null));
assertTrue("Should pass with 2 levels of one", PrereqHandler.passes(singlePrereq, character, null));
}
use of plugin.pretokens.parser.PreClassLevelMaxParser in project pcgen by PCGen.
the class PreClassLevelMaxRobin method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
TokenRegistration.register(new PreClassLevelMaxParser());
TokenRegistration.register(new PreClassParser());
TokenRegistration.register(new PreClassWriter());
}
use of plugin.pretokens.parser.PreClassLevelMaxParser in project pcgen by PCGen.
the class PreClassTest method testOldPreClassLevelMax.
public void testOldPreClassLevelMax() throws Exception {
final PreClassLevelMaxParser parser = new PreClassLevelMaxParser();
try {
parser.parse("CLASSLEVELMAX", "Fighter=2", false, false);
fail();
} catch (PersistenceLayerException e) {
// Do Nothing, we should catch an exception here
}
}
Aggregations