@Test public void testRun() throws Exception { StoptableThread thread = new TestThread(); thread.start(); ThreadUtils.sleep(5); System.out.println("before stop"); thread.stopSafely(); System.out.println("after stop"); ThreadUtils.sleep(5); }