1 package org.sapia.taskman; 2 3 import junit.framework.*; 4 5 8 public class PeriodicTaskTest extends TestCase { 9 12 public PeriodicTaskTest(String name) { 13 super(name); 14 } 15 16 public void testExecute() throws Exception { 17 TaskManager tm = new TaskManager("test"); 18 tm.setDaemon(true); 19 tm.start(); 20 21 TestTask t; 22 tm.execTaskFor(new PeriodicTaskDescriptor("test", 200, t = new TestTask())); 23 Thread.sleep(3000); 24 super.assertTrue( 25 "Task not executed for expected number of times - at least", 26 t.execCount > 2); 27 } 28 } 29 | Popular Tags |