コード例 #1
0
  /**
   * Executes the test.
   *
   * @since 1.00
   */
  private static void execute() {
    // start and stop in one step
    long start = System.currentTimeMillis();
    timerInOneMethod();
    long end = System.currentTimeMillis();
    timeStartStopOneStep = end - start;
    recIdStartStopOneStep = TestEnvironment.storeTimerData(ID_TIMER_START_FINISH);
    TestEnvironment.notice("should be approx. 2000 (vs. real time " + timeStartStopOneStep + ")");

    // start and stop in two steps
    start = System.currentTimeMillis();
    startProcessing();
    endProcessing();
    end = System.currentTimeMillis();
    timeStartStopTwoSteps = end - start;
    recIdStartStopTwoSteps = TestEnvironment.storeTimerData(ID_TIMER_START_FINISH2);
    TestEnvironment.notice("should be approx. 2000 (vs. real time " + timeStartStopTwoSteps + ")");

    // restart, stop and resume in two steps
    start = System.currentTimeMillis();
    startProcessing();
    interruptProcessing();
    continueProcessing();
    endProcessing();
    end = System.currentTimeMillis();
    timeRestartStopResumeTwoSteps = end - start;
    recIdRestartStopResumeTwoSteps = TestEnvironment.storeTimerData(ID_TIMER_START_FINISH2);
    TestEnvironment.notice(
        "should be approx. 2000 (vs. real time " + timeRestartStopResumeTwoSteps + ")");

    // restart and stop and resume in one step
    start = System.currentTimeMillis();
    startProcessing();
    interruptAndContinueProcessing();
    endProcessing();
    end = System.currentTimeMillis();
    timeRestartStopResumeOneStep = end - start;
    recIdRestartStopResumeOneStep = TestEnvironment.storeTimerData(ID_TIMER_START_FINISH2);
    TestEnvironment.notice(
        "should be approx. 2000 (vs. real time " + timeRestartStopResumeOneStep + ")");
  }