use of pcgen.base.test.InequalityTester in project pcgen by PCGen.
the class AbstractSaveRestoreTest method checkEquality.
protected void checkEquality() {
InequalityTester it = InequalityTesterInst.getInstance();
assertTrue(AbstractStorageFacet.areEqualCache(pc.getCharID(), reloadedPC.getCharID(), it));
}
use of pcgen.base.test.InequalityTester in project pcgen by PCGen.
the class AbstractSelectionActorTest method testAddRemoveSimple.
@Test
public void testAddRemoveSimple() throws PersistenceLayerException {
setUpPC();
finishLoad(Globals.getContext());
InequalityTester it = InequalityTesterInst.getInstance();
ChooseDriver owner = getOwner();
T t = construct("Templ");
T t2 = construct("Templ2");
PlayerCharacter pc1 = new PlayerCharacter();
PlayerCharacter pc2 = new PlayerCharacter();
preparePC(pc1, owner);
preparePC(pc2, owner);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
ChooseSelectionActor<T> actor = getActor();
actor.applyChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
actor.applyChoice(owner, t2, pc1);
actor.removeChoice(owner, t, pc1);
actor.applyChoice(owner, t2, pc2);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
}
use of pcgen.base.test.InequalityTester in project pcgen by PCGen.
the class AbstractSelectionActorTest method testAddRemoveHasChild.
@Test
public void testAddRemoveHasChild() throws PersistenceLayerException {
if (isGranted()) {
setUpPC();
T t = construct("Templ");
T t2 = construct("Templ2");
Globals.getContext().unconditionallyProcess(t, "AUTO", "LANG|Universal");
Globals.getContext().unconditionallyProcess(t2, "AUTO", "LANG|Other");
finishLoad(Globals.getContext());
InequalityTester it = InequalityTesterInst.getInstance();
ChooseDriver owner = getOwner();
PlayerCharacter pc1 = new PlayerCharacter();
PlayerCharacter pc2 = new PlayerCharacter();
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
ChooseSelectionActor<T> actor = getActor();
actor.applyChoice(owner, t, pc2);
assertTrue(pc2.hasLanguage(universal));
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc2);
assertFalse(pc2.hasLanguage(universal));
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc2);
assertFalse(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.removeChoice(owner, t, pc1);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
actor.applyChoice(owner, t, pc1);
actor.applyChoice(owner, t2, pc1);
actor.removeChoice(owner, t, pc1);
actor.applyChoice(owner, t2, pc2);
assertTrue(AbstractStorageFacet.areEqualCache(pc1.getCharID(), pc2.getCharID(), it));
}
}
Aggregations