Search in sources :

Example 6 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class PreClassTest method testInvalidSeparators.

/**
	 * Test that an error is produced if separators are incorrect
	 * @throws Exception
	 */
@Test
public void testInvalidSeparators() throws Exception {
    try {
        PreClassParser parser = new PreClassParser();
        Prerequisite prereq = parser.parse("class", "1,,Monk=1", false, false);
        fail("Should have thrown a PersistenceLayerException.");
    } catch (PersistenceLayerException e) {
    // Ignore, this is the expected result.
    }
}
Also used : PersistenceLayerException(pcgen.persistence.PersistenceLayerException) PreClassParser(plugin.pretokens.parser.PreClassParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 7 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class PreClassTest method testNoClassLevels.

@Test
public void testNoClassLevels() throws Exception {
    PreClassParser parser = new PreClassParser();
    Prerequisite prereq = parser.parse("class", "1,Monk=1", true, false);
    assertEquals("<prereq kind=\"class\" key=\"Monk\" operator=\"LT\" operand=\"1\" >\n" + "</prereq>\n", prereq.toString());
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 8 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class AbilityLstTest method setUp.

@Override
public void setUp() throws PersistenceLayerException, URISyntaxException {
    super.setUp();
    TokenRegistration.register(new PreRaceParser());
    TokenRegistration.register(new PreRaceWriter());
    TokenRegistration.register(new PreLevelParser());
    TokenRegistration.register(new PreLevelWriter());
    TokenRegistration.register(new PreClassParser());
    TokenRegistration.register(new PreClassWriter());
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) PreRaceWriter(plugin.pretokens.writer.PreRaceWriter) PreRaceParser(plugin.pretokens.parser.PreRaceParser) PreLevelWriter(plugin.pretokens.writer.PreLevelWriter) PreClassWriter(plugin.pretokens.writer.PreClassWriter) PreLevelParser(plugin.pretokens.parser.PreLevelParser)

Example 9 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class ClassesIntegrationTest method ltClassSetUp.

@BeforeClass
public static final void ltClassSetUp() throws PersistenceLayerException {
    TokenRegistration.register(new PreClassParser());
    classSetUpFired = true;
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) BeforeClass(org.junit.BeforeClass)

Example 10 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class AbstractTextPropertyTokenTestCase method setUp.

@Override
@Before
public void setUp() throws PersistenceLayerException, URISyntaxException {
    super.setUp();
    TokenRegistration.register(new PreLevelParser());
    TokenRegistration.register(new PreClassParser());
    TokenRegistration.register(new PreLevelWriter());
    TokenRegistration.register(new PreClassWriter());
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) PreLevelWriter(plugin.pretokens.writer.PreLevelWriter) PreClassWriter(plugin.pretokens.writer.PreClassWriter) PreLevelParser(plugin.pretokens.parser.PreLevelParser) Before(org.junit.Before)

Aggregations

PreClassParser (plugin.pretokens.parser.PreClassParser)13 PreClassWriter (plugin.pretokens.writer.PreClassWriter)6 Test (org.junit.Test)4 Prerequisite (pcgen.core.prereq.Prerequisite)4 PreLevelParser (plugin.pretokens.parser.PreLevelParser)4 PreLevelWriter (plugin.pretokens.writer.PreLevelWriter)4 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)3 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 PCClass (pcgen.core.PCClass)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 LoadContext (pcgen.rules.context.LoadContext)1 PreClassLevelMaxParser (plugin.pretokens.parser.PreClassLevelMaxParser)1 PreRaceParser (plugin.pretokens.parser.PreRaceParser)1 PreRaceWriter (plugin.pretokens.writer.PreRaceWriter)1