Search in sources :

Example 1 with AssocCheck

use of tokenmodel.testsupport.AssocCheck in project pcgen by PCGen.

the class AddAbilityVirtualTest method testMult.

@Test
public void testMult() throws PersistenceLayerException {
    TokenRegistration.register(new NoChoiceToken());
    TokenRegistration.register(new StackToken());
    Domain source = create(Domain.class, "Source");
    PCClass pcc = create(PCClass.class, "Class");
    Ability a = createGrantedObject();
    context.unconditionallyProcess(a, "MULT", "YES");
    context.unconditionallyProcess(a, "STACK", "YES");
    context.unconditionallyProcess(a, "CHOOSE", "NOCHOICE");
    runToken(source);
    processToken(source);
    assocCheck = new AssocCheck() {

        public boolean check(CNAbility g) {
            if (pc.getDetailedAssociationCount(g) == 2) {
                return true;
            } else {
                System.err.println("Incorrect Association Count");
                return false;
            }
        }
    };
    assertEquals(0, getCount());
    ClassSource classSource = new ClassSource(pcc);
    domainFacet.add(id, source, classSource);
    assertTrue(containsExpected(a));
    assertEquals(2, getCount());
    domainFacet.remove(id, source);
    assertEquals(0, getCount());
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) NoChoiceToken(plugin.lsttokens.choose.NoChoiceToken) StackToken(plugin.lsttokens.ability.StackToken) Domain(pcgen.core.Domain) PCClass(pcgen.core.PCClass) AssocCheck(tokenmodel.testsupport.AssocCheck) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractAddListTokenTest(tokenmodel.testsupport.AbstractAddListTokenTest)

Example 2 with AssocCheck

use of tokenmodel.testsupport.AssocCheck in project pcgen by PCGen.

the class AddAbilityNormalTest method testMult.

//TODO this appears to be a bug - is only applied once?
@Test
public void testMult() throws PersistenceLayerException {
    TokenRegistration.register(new NoChoiceToken());
    TokenRegistration.register(new StackToken());
    Domain source = create(Domain.class, "Source");
    PCClass pcc = create(PCClass.class, "Class");
    Ability a = createGrantedObject();
    context.unconditionallyProcess(a, "MULT", "YES");
    context.unconditionallyProcess(a, "STACK", "YES");
    context.unconditionallyProcess(a, "CHOOSE", "NOCHOICE");
    runToken(source);
    processToken(source);
    assocCheck = new AssocCheck() {

        public boolean check(CNAbility g) {
            if (pc.getDetailedAssociationCount(g) == 2) {
                return true;
            } else {
                System.err.println("Incorrect Association Count");
                return false;
            }
        }
    };
    assertEquals(0, getCount());
    ClassSource classSource = new ClassSource(pcc);
    domainFacet.add(id, source, classSource);
    assertTrue(containsExpected(a));
    assertEquals(2, getCount());
    domainFacet.remove(id, source);
    assertEquals(0, getCount());
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) NoChoiceToken(plugin.lsttokens.choose.NoChoiceToken) StackToken(plugin.lsttokens.ability.StackToken) Domain(pcgen.core.Domain) PCClass(pcgen.core.PCClass) AssocCheck(tokenmodel.testsupport.AssocCheck) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractAddListTokenTest(tokenmodel.testsupport.AbstractAddListTokenTest)

Aggregations

Test (org.junit.Test)2 CNAbility (pcgen.cdom.content.CNAbility)2 ClassSource (pcgen.cdom.helper.ClassSource)2 Ability (pcgen.core.Ability)2 Domain (pcgen.core.Domain)2 PCClass (pcgen.core.PCClass)2 StackToken (plugin.lsttokens.ability.StackToken)2 NoChoiceToken (plugin.lsttokens.choose.NoChoiceToken)2 AbstractAddListTokenTest (tokenmodel.testsupport.AbstractAddListTokenTest)2 AssocCheck (tokenmodel.testsupport.AssocCheck)2