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");
}
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());
}
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);
}
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());
}
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());
}
Aggregations