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

Method testNoSubsChoiceBonus

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

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

()

Source from the content-addressed store, hash-verified

244 * @throws Exception
245 */
246 @Test
247 public void testNoSubsChoiceBonus() throws Exception
248 {
249 CampaignSourceEntry source;
250 try
251 {
252 source = new CampaignSourceEntry(new Campaign(),
253 new URI("file:/" + getClass().getName() + ".java"));
254 }
255 catch (URISyntaxException e)
256 {
257 throw new UnreachableError(e);
258 }
259 AbilityLoader loader = new AbilityLoader();
260 loader
261 .parseLine(
262 Globals.getContext(),
263 null,
264 "Toughness CATEGORY:FEAT TYPE:General STACK:YES "
265 + "MULT:YES CHOOSE:NOCHOICE BONUS:HP|CURRENTMAX|3", source);
266 Ability pObj = Globals.getContext().getReferenceContext()
267 .getManufacturerId(BuildUtilities.getFeatCat()).getActiveObject("Toughness");
268 PlayerCharacter aPC = getCharacter();
269 int baseHP = aPC.hitPoints();
270 AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "");
271 aPC.calcActiveBonuses();
272 assertEquals("Should have added 3 HPs", baseHP + 3, aPC.hitPoints());
273
274 AbstractCharacterTestCase.applyAbility(aPC, BuildUtilities.getFeatCat(), pObj, "");
275 aPC.calcActiveBonuses();
276 assertEquals("2 instances should have added 6 HPs", baseHP + 6, aPC
277 .hitPoints());
278
279 }
280
281 /**
282 * Tests description handling

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected