Package java.util

Examples of java.util.Timer.cancel()


        exception = true;
      }
      assertTrue(
          "Scheduling a task with negative date should throw IllegalArgumentException",
          exception);
      t.cancel();

      // Ensure a Timer throws a NullPointerException if the task is null
      t = new Timer();
      exception = false;
      d = new Date(System.currentTimeMillis() + 100);
View Full Code Here


        exception = true;
      }
      assertTrue(
          "Scheduling a null task should throw NullPointerException",
          exception);
      t.cancel();

      // Ensure a Timer throws a NullPointerException if the date is null
      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
View Full Code Here

        exception = true;
      }
      assertTrue(
          "Scheduling a null date should throw NullPointerException",
          exception);
      t.cancel();

      // Ensure proper sequence of exceptions
      t = new Timer();
      d = new Date(-100);
      exception = false;
View Full Code Here

        exception = true;
      }
      assertTrue(
          "Scheduling a null task with negative date should throw IllegalArgumentException first",
          exception);
      t.cancel();

      // Ensure a task is run
      t = new Timer();
      testTask = new TimerTestTask();
      d = new Date(System.currentTimeMillis() + 200);
View Full Code Here

        Thread.sleep(400);
      } catch (InterruptedException e) {
      }
      assertEquals("TimerTask.run() method not called after 200ms",
          1, testTask.wasRun());
      t.cancel();

      // Ensure multiple tasks are run
      t = new Timer();
      testTask = new TimerTestTask();
      testTask.incrementCount(true);
View Full Code Here

      } catch (InterruptedException e) {
      }
      assertTrue(
          "Multiple tasks should have incremented counter 4 times not "
              + timerCounter, timerCounter == 4);
      t.cancel();
    } finally {
      if (t != null)
        t.cancel();
    }
  }
View Full Code Here

          "Multiple tasks should have incremented counter 4 times not "
              + timerCounter, timerCounter == 4);
      t.cancel();
    } finally {
      if (t != null)
        t.cancel();
    }
  }

  /**
   * @tests java.util.Timer#schedule(java.util.TimerTask, long)
View Full Code Here

    Timer t = null;
    try {
      // Ensure a Timer throws an IllegalStateException after cancelled
      t = new Timer();
      TimerTestTask testTask = new TimerTestTask();
      t.cancel();
      boolean exception = false;
      try {
        t.schedule(testTask, 100);
      } catch (IllegalStateException e) {
        exception = true;
View Full Code Here

        exception = true;
      }
      assertTrue(
          "Scheduling a task after cancelling it should throw exception",
          exception);
      t.cancel();

      // Ensure a Timer throws an IllegalArgumentException if delay is
      // negative
      t = new Timer();
      testTask = new TimerTestTask();
View Full Code Here

        exception = true;
      }
      assertTrue(
          "Scheduling a task with negative delay should throw IllegalArgumentException",
          exception);
      t.cancel();

      // Ensure a Timer throws a NullPointerException if the task is null
      t = new Timer();
      exception = false;
      try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.