Search in sources :

Example 26 with Deity

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"));
}
Also used : Deity(pcgen.core.Deity) StringManager(pcgen.base.format.StringManager)

Example 27 with Deity

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());
}
Also used : Deity(pcgen.core.Deity) Domain(pcgen.core.Domain) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 28 with Deity

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());
}
Also used : Deity(pcgen.core.Deity) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Example 29 with Deity

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;
}
Also used : Deity(pcgen.core.Deity) StringTokenizer(java.util.StringTokenizer)

Example 30 with Deity

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());
}
Also used : Deity(pcgen.core.Deity) Test(org.junit.Test)

Aggregations

Deity (pcgen.core.Deity)39 CDOMReference (pcgen.cdom.base.CDOMReference)8 Domain (pcgen.core.Domain)8 Test (org.junit.Test)5 WeaponProf (pcgen.core.WeaponProf)5 HashSet (java.util.HashSet)3 TreeSet (java.util.TreeSet)3 StringManager (pcgen.base.format.StringManager)3 PCAlignment (pcgen.core.PCAlignment)3 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 StringTokenizer (java.util.StringTokenizer)2 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)2 SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)2 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 NumberManager (pcgen.base.format.NumberManager)1 Indirect (pcgen.base.util.Indirect)1 WeightedCollection (pcgen.base.util.WeightedCollection)1 WrappedMapSet (pcgen.base.util.WrappedMapSet)1