📄 testsleep.java
字号:
/** * $Source: /home/ws/rz65/CVS-Repository/WorkflowProjects/JBPM-Demo/src/test/testjbpmdemo/testutil/TestSleep.java,v $ * $Revision: 1.1 $ * $Date: 2005/03/05 12:16:29 $ * $Author: rz65 $ * * Copyright (c) 2005 Universitaet Karlsruhe (TH) / Rechenzentrum (RZ-UNI-UKA) * * RZ-UNI-KA makes no representations or warranties about the suitability * of this software, either express or implied, including but not limited * to the implied warranties of merchantability, fitness for a particular * purpose, or non-infringement. RZ-UNI-KA shall not be liable for any * damages as a result of using, modifying or distributing this software * or its derivatives. */package testjbpmdemo.testutil;import jbpmdemo.util.Sleep;import testjbpmdemo.testutil.AbstractUtilTestCase;import junit.framework.Test;import junit.framework.TestSuite;import junit.textui.TestRunner;/** * A test case for the class {@link Sleep}. * * <p> * * @version $Revision: 1.1 $ * @author mailto:harald.meyer@rz.uni-karlsruhe.de */public class TestSleep extends AbstractUtilTestCase { /** * Builds a test case instance. * * @param name * The name of the case. */ public TestSleep(String name) { super(name); } /** * The stand-alone run main method. * * @param args * The run-time arguments (ignored) */ public static void main(String[] args) { TestRunner.run(suite()); } /** * Creates a test suite from this class. * * @return The test suite that covers all test... methods */ public static Test suite() { return new TestSuite(TestSleep.class); } private long now() { return System.currentTimeMillis(); } // tolerance in milliseconds because of errors caused by the timing // granularity private static final long TOL = 10; /** * Check the millisecond sleep method. */ public void testSleepMillis() { long msec1 = now(); long delay = 150; Sleep.sleepMillis(delay); long msec2 = now(); assertTrue(msec2 - msec1 + TOL >= delay); } /** * Check the second sleep method. */ public void testSleepSeconds() { long msec1 = now(); long delay = 3; Sleep.sleepSeconds(delay); long msec2 = now(); assertTrue(msec2 - msec1 + TOL >= 1000 * delay); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -