/** RaceParticipant: Wrapper to test the (abstract) peformRaceActivity() method. */ public void testPerformRaceActivity(String expectedActivityName) { // Make sure the athlete is re-set (not injured) defaultAthlete = getDefaultRacingAthlete(); assertEquals( "Race activity is not set properly", expectedActivityName, defaultAthlete.performRaceActivity()); }
/** Ascertain that performRaceActivity() throws an AthleteInjuredException when injured. */ @Test(expected = AthleteInjuredException.class) public void testPerformRaceActivity_Throws_OnInjury() { defaultAthlete.setIsInjured(true); defaultAthlete.performRaceActivity(); }