Search in sources :

Example 1 with ClassToken

use of plugin.lsttokens.choose.ClassToken in project pcgen by PCGen.

the class TemplateTargetSaveRestoreTest method testTemplateFavoredClass.

@Test
public void testTemplateFavoredClass() {
    PCClass monclass = create(PCClass.class, "MonClass");
    new TypeLst().parseToken(context, monclass, "Monster");
    PCTemplate monster = create(PCTemplate.class, "Monster");
    create(PCClass.class, "MyClass");
    new FavoredclassToken().parseToken(context, monster, "%LIST");
    new ClassToken().parseToken(context, monster, "MonClass|MyClass");
    finishLoad();
    pc.addTemplate(monster);
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.getDisplay().getFavoredClasses().contains(monclass));
    assertTrue(reloadedPC.getDisplay().getFavoredClasses().contains(monclass));
    reloadedPC.removeTemplate(monster);
    reloadedPC.setDirty(true);
    assertFalse(reloadedPC.getDisplay().getFavoredClasses().contains(monclass));
}
Also used : FavoredclassToken(plugin.lsttokens.template.FavoredclassToken) ClassToken(plugin.lsttokens.choose.ClassToken) PCClass(pcgen.core.PCClass) TypeLst(plugin.lsttokens.TypeLst) PCTemplate(pcgen.core.PCTemplate) AbstractGlobalTargetedSaveRestoreTest(pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest) Test(org.junit.Test)

Example 2 with ClassToken

use of plugin.lsttokens.choose.ClassToken in project pcgen by PCGen.

the class RaceTargetSaveRestoreTest method testRaceFavClass.

@Test
public void testRaceFavClass() {
    PCClass monclass = create(PCClass.class, "MonClass");
    new TypeLst().parseToken(context, monclass, "Monster");
    Race monster = create(Race.class, "Monster");
    Race other = create(Race.class, "Other");
    create(PCClass.class, "MyClass");
    new FavclassToken().parseToken(context, monster, "%LIST");
    new ClassToken().parseToken(context, monster, "MonClass|MyClass");
    finishLoad();
    pc.setRace(monster);
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.getDisplay().getFavoredClasses().contains(monclass));
    assertTrue(reloadedPC.getDisplay().getFavoredClasses().contains(monclass));
    reloadedPC.setRace(other);
    reloadedPC.setDirty(true);
    assertFalse(reloadedPC.getDisplay().getFavoredClasses().contains(monclass));
}
Also used : ClassToken(plugin.lsttokens.choose.ClassToken) Race(pcgen.core.Race) PCClass(pcgen.core.PCClass) TypeLst(plugin.lsttokens.TypeLst) FavclassToken(plugin.lsttokens.race.FavclassToken) Test(org.junit.Test) AbstractGlobalTargetedSaveRestoreTest(pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest)

Aggregations

Test (org.junit.Test)2 PCClass (pcgen.core.PCClass)2 AbstractGlobalTargetedSaveRestoreTest (pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest)2 TypeLst (plugin.lsttokens.TypeLst)2 ClassToken (plugin.lsttokens.choose.ClassToken)2 PCTemplate (pcgen.core.PCTemplate)1 Race (pcgen.core.Race)1 FavclassToken (plugin.lsttokens.race.FavclassToken)1 FavoredclassToken (plugin.lsttokens.template.FavoredclassToken)1