Search in sources :

Example 1 with WeaponProfToken

use of plugin.lsttokens.auto.WeaponProfToken in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testAutoWeaponProf.

@Test
public void testAutoWeaponProf() {
    WeaponProf granted = create(WeaponProf.class, "Granted");
    create(WeaponProf.class, "Ignored");
    T target = create(getObjectClass(), "Target");
    new WeaponProfToken().parseToken(context, target, "Granted");
    Object o = prepare(target);
    finishLoad();
    assertFalse(pc.hasWeaponProf(granted));
    applyObject(target);
    assertTrue(pc.hasWeaponProf(granted));
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.hasWeaponProf(granted));
    assertTrue(reloadedPC.hasWeaponProf(granted));
    remove(o);
    reloadedPC.setDirty(true);
    assertFalse(reloadedPC.hasWeaponProf(granted));
}
Also used : WeaponProfToken(plugin.lsttokens.auto.WeaponProfToken) WeaponProf(pcgen.core.WeaponProf) CDOMObject(pcgen.cdom.base.CDOMObject) Test(org.junit.Test)

Example 2 with WeaponProfToken

use of plugin.lsttokens.auto.WeaponProfToken in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testAutoWeaponProfList.

@Test
public void testAutoWeaponProfList() {
    WeaponProf granted = create(WeaponProf.class, "Granted");
    create(WeaponProf.class, "Ignored");
    T target = create(getObjectClass(), "Target");
    new WeaponProfToken().parseToken(context, target, "%LIST");
    new plugin.lsttokens.choose.WeaponProficiencyToken().parseToken(context, target, "Granted|Ignored");
    additionalChooseSet(target);
    Object o = prepare(target);
    finishLoad();
    assertFalse(pc.hasWeaponProf(granted));
    applyObject(target);
    assertTrue(pc.hasWeaponProf(granted));
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.hasWeaponProf(granted));
    assertTrue(reloadedPC.hasWeaponProf(granted));
    remove(o);
    reloadedPC.setDirty(true);
    if (isSymmetric()) {
        assertFalse(reloadedPC.hasWeaponProf(granted));
    }
}
Also used : WeaponProfToken(plugin.lsttokens.auto.WeaponProfToken) WeaponProf(pcgen.core.WeaponProf) CDOMObject(pcgen.cdom.base.CDOMObject) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CDOMObject (pcgen.cdom.base.CDOMObject)2 WeaponProf (pcgen.core.WeaponProf)2 WeaponProfToken (plugin.lsttokens.auto.WeaponProfToken)2