@Test public void testChangePrerequisite() throws Exception { IGenericTrait unwanted = new ValuedTraitType(AbilityType.Athletics, 4); IGenericTrait expected = new ValuedTraitType(AbilityType.Athletics, 2); data.addPrerequisite(unwanted); data.addPrerequisite(expected); assertEquals(1, data.getPrerequisites().length); assertTrue(ArrayUtilities.containsValue(data.getPrerequisites(), expected)); assertFalse(ArrayUtilities.containsValue(data.getPrerequisites(), unwanted)); }
@Test(expected = IllegalArgumentException.class) public void testCannotRemovePrimaryPrerequisite() throws Exception { IGenericTrait expected = new ValuedTraitType(AbilityType.Awareness, 4); data.setPrimaryPrerequisite(expected); data.removePrerequisite(expected); assertEquals(1, data.getPrerequisites().length); assertTrue(ArrayUtilities.containsValue(data.getPrerequisites(), expected)); }
@Test public void testGenericAttributes() throws Exception { String xml = "<charm><genericCharmAttribute attribute=\"test\"/></charm>"; // $NON-NLS-1$ Element rootElement = DocumentUtilities.read(xml).getRootElement(); ICharmAttribute[] attribute = new CharmAttributeBuilder() .buildCharmAttributes(rootElement, new ValuedTraitType(AbilityType.Brawl, 3)); assertTrue( ArrayUtilities.containsValue( attribute, new CharmAttribute("testBrawl", false))); // $NON-NLS-1$ }
public final boolean isCompulsiveCharm(ICharm charm) { String[] compulsiveCharmIDs = context.getAdditionalRules().getCompulsiveCharmIDs(); return ArrayUtilities.containsValue(compulsiveCharmIDs, charm.getId()); }
private boolean isSpellCircleGreaterThanMaximumCircle(CircleType type) { return !ArrayUtilities.containsValue(type.getComparableCircles(), maximumCircle) || (maximumCircle.compareTo(type) < 0); }