use of pcgen.cdom.base.CDOMListObject in project pcgen by PCGen.
the class SpellListTokenTest method testUnparseSingle.
@Test
public void testUnparseSingle() throws PersistenceLayerException {
ClassSpellList wp1 = construct(primaryContext, "TestWP1");
PersistentTransitionChoice<CDOMListObject<Spell>> tc = buildChoice(CDOMDirectSingleRef.getRef(wp1));
primaryProf.put(ObjectKey.SPELLLIST_CHOICE, tc);
String[] unparsed = getToken().unparse(primaryContext, primaryProf);
expectSingle(unparsed, "1|TestWP1");
}
use of pcgen.cdom.base.CDOMListObject in project pcgen by PCGen.
the class SpellListTokenTest method testUnparseNullInList.
@Test
public void testUnparseNullInList() throws PersistenceLayerException {
ClassSpellList wp1 = construct(primaryContext, "TestWP1");
ReferenceChoiceSet<ClassSpellList> rcs = buildRCS(CDOMDirectSingleRef.getRef(wp1), null);
PersistentTransitionChoice<CDOMListObject<Spell>> tc = buildTC(rcs);
primaryProf.put(ObjectKey.SPELLLIST_CHOICE, tc);
try {
getToken().unparse(primaryContext, primaryProf);
fail();
} catch (NullPointerException e) {
// Yep!
}
}
use of pcgen.cdom.base.CDOMListObject in project pcgen by PCGen.
the class PCGVer2Creator method appendSpellListLines.
/*
* ###############################################################
* Spell List Information methods
* ###############################################################
*/
/*
* #Spell List Information
* SPELLLIST:sourceclassname|spelllistentry|spelllistentry
*/
private void appendSpellListLines(StringBuilder buffer) {
for (PCClass pcClass : charDisplay.getClassSet()) {
TransitionChoice<CDOMListObject<Spell>> csc = pcClass.get(ObjectKey.SPELLLIST_CHOICE);
if (csc != null) {
List<? extends CDOMList<Spell>> assocList = charDisplay.getSpellLists(pcClass);
buffer.append(IOConstants.TAG_SPELLLIST).append(':');
buffer.append(pcClass.getKeyName());
for (CDOMList<Spell> spell : assocList) {
buffer.append('|');
if (ClassSpellList.class.equals(spell.getClass())) {
buffer.append("CLASS");
} else {
buffer.append("DOMAIN");
}
buffer.append('.').append(spell.getLSTformat());
}
buffer.append(IOConstants.LINE_SEP);
}
}
}
Aggregations