コード例 #1
0
  /** 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());
  }
コード例 #2
0
  /** Ascertain that performRaceActivity() throws an AthleteInjuredException when injured. */
  @Test(expected = AthleteInjuredException.class)
  public void testPerformRaceActivity_Throws_OnInjury() {
    defaultAthlete.setIsInjured(true);

    defaultAthlete.performRaceActivity();
  }