use of pcgen.cdom.choiceset.ReferenceChoiceSet in project pcgen by PCGen.
the class SpellListTokenTest method testUnparseBadCount.
@Test
public void testUnparseBadCount() throws PersistenceLayerException {
ClassSpellList wp1 = construct(primaryContext, "TestWP1");
ReferenceChoiceSet<ClassSpellList> rcs = new ReferenceChoiceSet<>(Collections.singletonList(CDOMDirectSingleRef.getRef(wp1)));
ChoiceSet<ClassSpellList> cs = new ChoiceSet<>(token.getTokenName(), rcs);
cs.setTitle("Pick a ClassSpellList");
PersistentTransitionChoice<CDOMListObject<Spell>> tc1 = new ConcretePersistentTransitionChoice<>(cs, null);
primaryProf.put(ObjectKey.SPELLLIST_CHOICE, tc1);
assertBadUnparse();
}
use of pcgen.cdom.choiceset.ReferenceChoiceSet in project pcgen by PCGen.
the class SkillListTokenTest method testUnparseBadCount.
@Test
public void testUnparseBadCount() throws PersistenceLayerException {
ClassSkillList wp1 = construct(primaryContext, "TestWP1");
ReferenceChoiceSet<ClassSkillList> rcs = new ReferenceChoiceSet<>(Collections.singletonList(CDOMDirectSingleRef.getRef(wp1)));
ChoiceSet<ClassSkillList> cs = new ChoiceSet<>(token.getTokenName(), rcs);
cs.setTitle("Pick a ClassSkillList");
PersistentTransitionChoice<ClassSkillList> tc1 = new ConcretePersistentTransitionChoice<>(cs, null);
primaryProf.put(ObjectKey.SKILLLIST_CHOICE, tc1);
assertBadUnparse();
}
use of pcgen.cdom.choiceset.ReferenceChoiceSet in project pcgen by PCGen.
the class ClassSkillsLevelTokenTest method testUnparseTrained.
@Test
public void testUnparseTrained() throws PersistenceLayerException {
List<CDOMReference<Skill>> refs = new ArrayList<>();
ObjectMatchingReference<Skill, Boolean> omr = new ObjectMatchingReference<>("TRAINED", Skill.class, getAllRef(), ObjectKey.USE_UNTRAINED, Boolean.FALSE);
omr.returnIncludesNulls(true);
refs.add(omr);
ReferenceChoiceSet<Skill> rcs = new ReferenceChoiceSet<>(refs);
ChoiceSet<Skill> cs = new ChoiceSet<>(getSubToken().getTokenName(), rcs);
PersistentTransitionChoice<Skill> tc = new ConcretePersistentTransitionChoice<>(cs, FormulaFactory.ONE);
primaryProf.addToListFor(ListKey.ADD, tc);
tc.setChoiceActor(new ClassSkillChoiceActor(fighter, null));
String[] unparsed = getToken().unparse(primaryContext, primaryProf);
expectSingle(unparsed, getSubTokenName() + '|' + "TRAINED");
}
use of pcgen.cdom.choiceset.ReferenceChoiceSet in project pcgen by PCGen.
the class ClassSkillsLevelTokenTest method testUnparseNonExclusive.
@Test
public void testUnparseNonExclusive() throws PersistenceLayerException {
List<CDOMReference<Skill>> refs = new ArrayList<>();
ObjectMatchingReference<Skill, Boolean> omr = new ObjectMatchingReference<>("NONEXCLUSIVE", Skill.class, getAllRef(), ObjectKey.EXCLUSIVE, Boolean.FALSE);
omr.returnIncludesNulls(true);
refs.add(omr);
ReferenceChoiceSet<Skill> rcs = new ReferenceChoiceSet<>(refs);
ChoiceSet<Skill> cs = new ChoiceSet<>(getSubToken().getTokenName(), rcs);
PersistentTransitionChoice<Skill> tc = new ConcretePersistentTransitionChoice<>(cs, FormulaFactory.ONE);
primaryProf.addToListFor(ListKey.ADD, tc);
tc.setChoiceActor(new ClassSkillChoiceActor(fighter, null));
String[] unparsed = getToken().unparse(primaryContext, primaryProf);
expectSingle(unparsed, getSubTokenName() + '|' + "NONEXCLUSIVE");
}
use of pcgen.cdom.choiceset.ReferenceChoiceSet in project pcgen by PCGen.
the class ClassSkillsTokenTest method testUnparseExclusive.
@Test
public void testUnparseExclusive() throws PersistenceLayerException {
List<CDOMReference<Skill>> refs = new ArrayList<>();
ObjectMatchingReference<Skill, Boolean> omr = new ObjectMatchingReference<>("EXCLUSIVE", Skill.class, getAllRef(), ObjectKey.EXCLUSIVE, Boolean.TRUE);
omr.returnIncludesNulls(true);
refs.add(omr);
ReferenceChoiceSet<Skill> rcs = new ReferenceChoiceSet<>(refs);
ChoiceSet<Skill> cs = new ChoiceSet<>(getSubToken().getTokenName(), rcs);
PersistentTransitionChoice<Skill> tc = new ConcretePersistentTransitionChoice<>(cs, FormulaFactory.ONE);
primaryProf.addToListFor(ListKey.ADD, tc);
tc.setChoiceActor(new ClassSkillChoiceActor(fighter, null));
String[] unparsed = getToken().unparse(primaryContext, primaryProf);
expectSingle(unparsed, getSubTokenName() + '|' + "EXCLUSIVE");
}
Aggregations