use of pcgen.core.Deity in project pcgen by PCGen.
the class PreDeityTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
deity = new Deity();
deity.setName("Test Deity");
deity.put(ObjectKey.ALIGNMENT, CDOMDirectSingleRef.getRef(ng));
StringManager sm = new StringManager();
FactSetKey<String> fsk = FactSetKey.getConstant("Pantheon", sm);
deity.addToSetFor(fsk, new BasicIndirect<>(sm, "Celtic"));
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class PreDeityDomainTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
Domain goodDomain = new Domain();
goodDomain.setName("Good");
Globals.getContext().getReferenceContext().importObject(goodDomain);
Domain animalDomain = new Domain();
animalDomain.setName("Animal");
Globals.getContext().getReferenceContext().importObject(animalDomain);
deity = new Deity();
deity.setName("Test Deity");
deity.put(ObjectKey.ALIGNMENT, CDOMDirectSingleRef.getRef(ng));
deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(goodDomain), new SimpleAssociatedObject());
deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(animalDomain), new SimpleAssociatedObject());
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class AbstractContentTokenTest method testFromDeity.
@Test
public void testFromDeity() throws PersistenceLayerException {
Deity source = create(Deity.class, "Source");
processToken(source);
assertEquals(baseCount(), targetFacetCount());
deityFacet.set(id, source);
assertTrue(containsExpected());
assertEquals(baseCount() + 1, targetFacetCount());
deityFacet.remove(id);
assertEquals(baseCount(), targetFacetCount());
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class DeityToken method parseTokenWithSeparator.
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, PCClass pcc, String value) {
context.getObjectContext().removeList(pcc, ListKey.DEITY);
final StringTokenizer tok = new StringTokenizer(value, Constants.PIPE);
while (tok.hasMoreTokens()) {
String tokText = tok.nextToken();
CDOMReference<Deity> deity = context.getReferenceContext().getCDOMReference(DEITY_CLASS, tokText);
context.getObjectContext().addToList(pcc, ListKey.DEITY, deity);
}
return ParseResult.SUCCESS;
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class DeityTokenTest method testUnparseMultiple.
@Test
public void testUnparseMultiple() throws PersistenceLayerException {
Deity wp1 = construct(primaryContext, getLegalValue());
primaryProf.addToListFor(ListKey.DEITY, CDOMDirectSingleRef.getRef(wp1));
Deity wp2 = construct(primaryContext, getAlternateLegalValue());
primaryProf.addToListFor(ListKey.DEITY, CDOMDirectSingleRef.getRef(wp2));
String[] unparsed = getToken().unparse(primaryContext, primaryProf);
expectSingle(unparsed, getLegalValue() + getJoinCharacter() + getAlternateLegalValue());
}
Aggregations