Search in sources :

Example 16 with Deity

use of pcgen.core.Deity in project pcgen by PCGen.

the class FactSetKeyActorTest method testSetJoined.

public void testSetJoined() {
    Deity d = new Deity();
    d.setName("Bob");
    String expectedResult1 = "Magical";
    String expectedResult2 = "Long";
    df.set(id, d);
    d.addToListFor(ListKey.BOOK_TYPE, expectedResult1);
    d.addToListFor(ListKey.BOOK_TYPE, expectedResult2);
    StringManager mgr = new StringManager();
    FactSetKey<String> fsk = FactSetKey.getConstant("booktype", mgr);
    d.addToSetFor(fsk, new BasicIndirect<>(mgr, expectedResult1));
    d.addToSetFor(fsk, new BasicIndirect<>(mgr, expectedResult2));
    FactSetKeyActor<?> lka = new FactSetKeyActor<>(fsk);
    CDOMObjectWrapper.load(dsid, d.getClass(), "booktype", lka);
    processThroughFreeMarker("${deity.booktype?join(\", \")!}", "Magical, Long");
}
Also used : Deity(pcgen.core.Deity) StringManager(pcgen.base.format.StringManager)

Example 17 with Deity

use of pcgen.core.Deity in project pcgen by PCGen.

the class IntegerKeyActorTest method testIntegerKeyActor.

public void testIntegerKeyActor() {
    Deity d = new Deity();
    d.setName("Bob");
    Integer expectedResult = 475;
    df.set(id, d);
    d.put(IntegerKey.COST, expectedResult);
    IntegerKeyActor ika = new IntegerKeyActor(IntegerKey.COST);
    CDOMObjectWrapper.load(dsid, d.getClass(), "cost", ika);
    processThroughFreeMarker("${deity.cost}", expectedResult.toString());
}
Also used : Deity(pcgen.core.Deity)

Example 18 with Deity

use of pcgen.core.Deity in project pcgen by PCGen.

the class ListKeyActorTest method testListKeyActor.

public void testListKeyActor() {
    Deity d = new Deity();
    d.setName("Bob");
    String expectedResult1 = "Magical";
    String expectedResult2 = "Long";
    df.set(id, d);
    d.addToListFor(ListKey.BOOK_TYPE, expectedResult1);
    d.addToListFor(ListKey.BOOK_TYPE, expectedResult2);
    ListKeyActor lka = new ListKeyActor(ListKey.BOOK_TYPE);
    CDOMObjectWrapper.load(dsid, d.getClass(), "booktype", lka);
    processThroughFreeMarker("${deity.booktype[0]}", expectedResult1);
    processThroughFreeMarker("${deity.booktype[1]}", expectedResult2);
}
Also used : Deity(pcgen.core.Deity)

Example 19 with Deity

use of pcgen.core.Deity in project pcgen by PCGen.

the class ObjectKeyActorTest method testBasicObjectKeyActor.

public void testBasicObjectKeyActor() {
    Deity d = new Deity();
    d.setName("Bob");
    BigDecimal expectedResult = new BigDecimal("4.063");
    df.set(id, d);
    d.put(ObjectKey.COST, expectedResult);
    ObjectKeyActor<BigDecimal> oka = new ObjectKeyActor<>(ObjectKey.COST);
    CDOMObjectWrapper.load(dsid, d.getClass(), "cost", oka);
    processThroughFreeMarker("${deity.cost}", expectedResult.toString());
}
Also used : Deity(pcgen.core.Deity) BigDecimal(java.math.BigDecimal)

Example 20 with Deity

use of pcgen.core.Deity in project pcgen by PCGen.

the class ObjectKeyActorTest method testWrappedObjectKeyActor.

public void testWrappedObjectKeyActor() {
    Deity d = new Deity();
    d.setName("Bob");
    PCStat str = new PCStat();
    str.setName("Strength");
    BigDecimal expectedResult = new BigDecimal("4.063");
    str.put(ObjectKey.COST, expectedResult);
    df.set(id, d);
    d.put(ObjectKey.SPELL_STAT, CDOMDirectSingleRef.getRef(str));
    ObjectKeyActor<BigDecimal> oka_cost = new ObjectKeyActor<>(ObjectKey.COST);
    CDOMObjectWrapper.load(dsid, str.getClass(), "cost", oka_cost);
    ObjectKeyActor<CDOMSingleRef<PCStat>> oka_stat = new ObjectKeyActor<>(ObjectKey.SPELL_STAT);
    CDOMObjectWrapper.load(dsid, d.getClass(), "stat", oka_stat);
    processThroughFreeMarker("${deity.stat}", str.getDisplayName());
    processThroughFreeMarker("${deity.stat.cost}", expectedResult.toString());
}
Also used : Deity(pcgen.core.Deity) PCStat(pcgen.core.PCStat) CDOMSingleRef(pcgen.cdom.reference.CDOMSingleRef) BigDecimal(java.math.BigDecimal)

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