Search in sources :

Example 26 with CNAbilitySelection

use of pcgen.cdom.helper.CNAbilitySelection in project pcgen by PCGen.

the class AbstractCNASEnforcingFacetTest method testDifferentSelectionStack.

@Test
public void testDifferentSelectionStack() {
    Object source1 = new Object();
    assertTrue(getFacet().isEmpty(id));
    assertEquals(0, getFacet().getCount(id));
    CNAbility n1 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, stackyes);
    CNAbility n2 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, stackyes);
    CNAbilitySelection cnas1 = new CNAbilitySelection(n1, "English");
    CNAbilitySelection cnas2 = new CNAbilitySelection(n2, "German");
    assertTrue(getFacet().add(id, cnas1, source1));
    assertFalse(getFacet().isEmpty(id));
    assertEquals(1, getFacet().getCount(id));
    assertTrue(getFacet().add(id, cnas2, source1));
    assertEquals(2, getFacet().getCount(id));
    assertTrue(getFacet().remove(id, cnas2, source1));
    assertEquals(1, getFacet().getCount(id));
    assertFalse(getFacet().isEmpty(id));
    assertTrue(getFacet().remove(id, cnas1, source1));
    assertEquals(0, getFacet().getCount(id));
    assertTrue(getFacet().isEmpty(id));
}
Also used : CNAbility(pcgen.cdom.content.CNAbility) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) Test(org.junit.Test)

Example 27 with CNAbilitySelection

use of pcgen.cdom.helper.CNAbilitySelection in project pcgen by PCGen.

the class AbstractCNASEnforcingFacetTest method testDifferentAbility.

@Test
public void testDifferentAbility() {
    Object source1 = new Object();
    assertTrue(getFacet().isEmpty(id));
    assertEquals(0, getFacet().getCount(id));
    CNAbility nomultCNA = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, nomult);
    CNAbility othernomultCNA = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, othernomult);
    CNAbilitySelection cnas1 = new CNAbilitySelection(nomultCNA);
    CNAbilitySelection cnas2 = new CNAbilitySelection(othernomultCNA);
    assertTrue(getFacet().add(id, cnas1, source1));
    assertFalse(getFacet().isEmpty(id));
    assertEquals(1, getFacet().getCount(id));
    assertTrue(getFacet().add(id, cnas2, source1));
    assertEquals(2, getFacet().getCount(id));
    assertTrue(getFacet().remove(id, cnas2, source1));
    assertEquals(1, getFacet().getCount(id));
    assertFalse(getFacet().isEmpty(id));
    assertTrue(getFacet().remove(id, cnas1, source1));
    assertEquals(0, getFacet().getCount(id));
    assertTrue(getFacet().isEmpty(id));
}
Also used : CNAbility(pcgen.cdom.content.CNAbility) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) Test(org.junit.Test)

Example 28 with CNAbilitySelection

use of pcgen.cdom.helper.CNAbilitySelection in project pcgen by PCGen.

the class AbstractCNASEnforcingFacetTest method testDifferentSelection.

@Test
public void testDifferentSelection() {
    Object source1 = new Object();
    assertTrue(getFacet().isEmpty(id));
    assertEquals(0, getFacet().getCount(id));
    CNAbility n1 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, multyes);
    CNAbility n2 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, multyes);
    CNAbilitySelection cnas1 = new CNAbilitySelection(n1, "English");
    CNAbilitySelection cnas2 = new CNAbilitySelection(n2, "German");
    assertTrue(getFacet().add(id, cnas1, source1));
    assertFalse(getFacet().isEmpty(id));
    assertEquals(1, getFacet().getCount(id));
    assertTrue(getFacet().add(id, cnas2, source1));
    assertEquals(2, getFacet().getCount(id));
    assertTrue(getFacet().remove(id, cnas2, source1));
    assertEquals(1, getFacet().getCount(id));
    assertFalse(getFacet().isEmpty(id));
    assertTrue(getFacet().remove(id, cnas1, source1));
    assertEquals(0, getFacet().getCount(id));
    assertTrue(getFacet().isEmpty(id));
}
Also used : CNAbility(pcgen.cdom.content.CNAbility) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) Test(org.junit.Test)

Example 29 with CNAbilitySelection

use of pcgen.cdom.helper.CNAbilitySelection in project pcgen by PCGen.

the class AbstractCNASEnforcingFacetTest method testDifferentSelectionAndNature.

@Test
public void testDifferentSelectionAndNature() {
    Object source1 = new Object();
    assertTrue(getFacet().isEmpty(id));
    assertEquals(0, getFacet().getCount(id));
    CNAbility normal = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, multyes);
    CNAbility virtual = CNAbilityFactory.getCNAbility(feat, Nature.VIRTUAL, multyes);
    CNAbilitySelection cnas1 = new CNAbilitySelection(normal, "English");
    CNAbilitySelection cnas2 = new CNAbilitySelection(virtual, "German");
    assertTrue(getFacet().add(id, cnas1, source1));
    assertFalse(getFacet().isEmpty(id));
    assertEquals(1, getFacet().getCount(id));
    assertTrue(getFacet().add(id, cnas2, source1));
    assertEquals(2, getFacet().getCount(id));
    assertTrue(getFacet().remove(id, cnas2, source1));
    assertEquals(1, getFacet().getCount(id));
    assertFalse(getFacet().isEmpty(id));
    assertTrue(getFacet().remove(id, cnas1, source1));
    assertEquals(0, getFacet().getCount(id));
    assertTrue(getFacet().isEmpty(id));
}
Also used : CNAbility(pcgen.cdom.content.CNAbility) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) Test(org.junit.Test)

Example 30 with CNAbilitySelection

use of pcgen.cdom.helper.CNAbilitySelection in project pcgen by PCGen.

the class AbstractCNASEnforcingFacetTest method getObject.

protected CNAbilitySelection getObject() {
    Ability a1 = new Ability();
    a1.setName("Abil");
    a1.setCDOMCategory(AbilityCategory.FEAT);
    return new CNAbilitySelection(CNAbilityFactory.getCNAbility(AbilityCategory.FEAT, Nature.VIRTUAL, a1));
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection)

Aggregations

CNAbilitySelection (pcgen.cdom.helper.CNAbilitySelection)70 CNAbility (pcgen.cdom.content.CNAbility)35 Test (org.junit.Test)28 Ability (pcgen.core.Ability)26 ArrayList (java.util.ArrayList)17 AbilityCategory (pcgen.core.AbilityCategory)7 CDOMReference (pcgen.cdom.base.CDOMReference)6 PlayerCharacter (pcgen.core.PlayerCharacter)6 ParseResult (pcgen.rules.persistence.token.ParseResult)6 ConcretePersistentTransitionChoice (pcgen.cdom.base.ConcretePersistentTransitionChoice)5 AbilityRefChoiceSet (pcgen.cdom.choiceset.AbilityRefChoiceSet)5 Nature (pcgen.cdom.enumeration.Nature)5 PCTemplate (pcgen.core.PCTemplate)5 CharID (pcgen.cdom.enumeration.CharID)4 List (java.util.List)3 AbilityChoiceSet (pcgen.cdom.base.ChoiceSet.AbilityChoiceSet)3 SpecialAbility (pcgen.core.SpecialAbility)3 BonusObj (pcgen.core.bonus.BonusObj)3 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)3 HashSet (java.util.HashSet)2