MCPcopy Create free account
hub / github.com/PCGen/pcgen / testNoChoiceBonus

Method testNoChoiceBonus

code/src/test/pcgen/core/PObjectTest.java:204–239  ·  view source on GitHub ↗

Test the function of adding an ability multiple times which has no choices and adds a static bonus. @throws Exception

()

Source from the content-addressed store, hash-verified

202 * @throws Exception
203 */
204 @Test
205 public void testNoChoiceBonus() throws Exception
206 {
207 CampaignSourceEntry source;
208 try
209 {
210 source = new CampaignSourceEntry(new Campaign(),
211 new URI("file:/" + getClass().getName() + ".java"));
212 }
213 catch (URISyntaxException e)
214 {
215 throw new UnreachableError(e);
216 }
217 AbilityLoader loader = new AbilityLoader();
218 loader
219 .parseLine(
220 Globals.getContext(),
221 null,
222 "Toughness CATEGORY:FEAT TYPE:General STACK:YES "
223 + "MULT:YES CHOOSE:NOCHOICE BONUS:HP|CURRENTMAX|3", source);
224
225 Ability pObj = Globals.getContext().getReferenceContext()
226 .getManufacturerId(BuildUtilities.getFeatCat()).getActiveObject("Toughness");
227 Globals.getContext().getReferenceContext().constructCDOMObject(Language.class, "Foo");
228 PlayerCharacter aPC = getCharacter();
229 int baseHP = aPC.hitPoints();
230 AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "");
231 aPC.calcActiveBonuses();
232 assertEquals("Should have added 3 HPs", baseHP + 3, aPC.hitPoints());
233
234 AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "");
235 aPC.calcActiveBonuses();
236 assertEquals("2 instances should have added 6 HPs", baseHP + 6, aPC
237 .hitPoints());
238
239 }
240
241 /**
242 * Test the function of adding an ability multiple times which has

Callers

nothing calls this directly

Calls 12

parseLineMethod · 0.95
getContextMethod · 0.95
getFeatCatMethod · 0.95
hitPointsMethod · 0.95
applyAbilityMethod · 0.95
calcActiveBonusesMethod · 0.95
constructCDOMObjectMethod · 0.80
getNameMethod · 0.65
getActiveObjectMethod · 0.65
getReferenceContextMethod · 0.65
getManufacturerIdMethod · 0.45
getCharacterMethod · 0.45

Tested by

no test coverage detected