예제 #1
0
  public void testSimpleGetTime() {
    List<Long> times = new ArrayList<>(20);
    for (int i = 0; i < 20; i++) times.add(time_service.timestamp());

    System.out.println("times=" + times);

    Set<Long> set = new HashSet<>(times);
    System.out.println("set = " + set);

    assert set.size() < times.size();
    assert times.size() <= 20;

    set.clear();
    time_service.stop().interval(50).start();
    for (int i = 0; i < 20; i++) {
      set.add(time_service.timestamp());
      Util.sleep(200);
    }

    System.out.println("set=" + set);

    assert set.size() >= 15;
  }
예제 #2
0
 public void testStartStop() {
   assert time_service.running();
   time_service.stop();
   Util.sleep(2000);
   assert !time_service.running();
 }
예제 #3
0
 public void testChangeInterval() {
   time_service.interval(1000).start();
   assert time_service.interval() == 1000;
 }
예제 #4
0
 @AfterMethod
 public void stop() {
   time_service.stop();
 }