use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreAbilityParserTest method testSingleEntry.
/**
* @throws Exception
*/
@Test
public void testSingleEntry() throws Exception {
PreAbilityParser parser = new PreAbilityParser();
Prerequisite prereq = parser.parse("ability", "1,Sneak Attack", false, false);
assertEquals("Category not specified for single key", "<prereq kind=\"ability\" key=\"Sneak Attack\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "", prereq.toString());
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreAbilityParserTest method testInvalidCharacter.
/**
* Test that an error is produced if separators are incorrect
* @throws Exception
*/
@Test
public void testInvalidCharacter() throws Exception {
try {
PreAbilityParser parser = new PreAbilityParser();
Prerequisite prereq = parser.parse("ability", "1,CATEGORY.Mutation,KEY_a|Key_b", false, false);
fail("Should have thrown a PersistenceLayerException.");
} catch (PersistenceLayerException e) {
// Ignore, this is the expected result.
}
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreAbilityParserTest method testInvalidSeparators.
/**
* Test that an error is produced if separators are incorrect
* @throws Exception
*/
@Test
public void testInvalidSeparators() throws Exception {
try {
PreAbilityParser parser = new PreAbilityParser();
Prerequisite prereq = parser.parse("ability", "1,CATEGORY.Mutation,,KEY_a", false, false);
fail("Should have thrown a PersistenceLayerException.");
} catch (PersistenceLayerException e) {
// Ignore, this is the expected result.
}
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreAbilityParserTest method testNoKey.
/**
* @throws Exception
*/
@Test
public void testNoKey() throws Exception {
PreAbilityParser parser = new PreAbilityParser();
Prerequisite prereq = parser.parse("ability", "1,CATEGORY.Mutation", false, false);
assertEquals("Category specified for no key", "<prereq kind=\"ability\" category=\"Mutation\" key=\"ANY\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "", prereq.toString());
}
use of pcgen.core.prereq.Prerequisite in project pcgen by PCGen.
the class PreLanguageParserTest method testNot1LanguageOf2.
/**
* @throws Exception
*/
@Test
public void testNot1LanguageOf2() throws Exception {
PreLanguageParser parser = new PreLanguageParser();
Prerequisite prereq = parser.parse("LANG", "1,Dwarven,Elven", true, false);
System.out.println(prereq);
assertEquals("<prereq operator=\"LT\" operand=\"1\" >\n" + "<prereq kind=\"lang\" count-multiples=\"true\" key=\"Dwarven\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "<prereq kind=\"lang\" count-multiples=\"true\" key=\"Elven\" operator=\"GTEQ\" operand=\"1\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
Aggregations