Author: rahul
Date: Tue Feb 28 21:18:41 2006
New Revision: 381909
URL: http://svn.apache.org/viewcvs?rev=381909&view=rev
Log:
A test case for the stop watch usecase.
Added:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
(with props)
Modified:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
Modified:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java?rev=381909&r1=381908&r2=381909&view=diff
==============================================================================
---
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
(original)
+++
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
Tue Feb 28 21:18:41 2006
@@ -49,6 +49,7 @@
suite.setName("Commons-SCXML Environments Tests");
suite.addTest(LogUtilsTest.suite());
suite.addTest(SimpleContextTest.suite());
+ suite.addTest(StopWatchTest.suite());
return suite;
}
}
Added:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java?rev=381909&view=auto
==============================================================================
---
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
(added)
+++
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
Tue Feb 28 21:18:41 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.env;
+
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class StopWatchTest extends TestCase {
+
+ public StopWatchTest(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(StopWatchTest.class);
+ }
+
+ public static void main(String args[]) {
+ String[] testCaseName = { StopWatchTest.class.getName()};
+ junit.textui.TestRunner.main(testCaseName);
+ }
+
+ private StopWatch stopWatch;
+
+ /**
+ * Set up instance variables required by this test case.
+ */
+ public void setUp() {
+ stopWatch = new StopWatch();
+ }
+
+ /**
+ * Tear down instance variables required by this test case.
+ */
+ public void tearDown() {
+ stopWatch = null;
+ }
+
+ public void testStopWatch() {
+ assertEquals("reset", stopWatch.getCurrentState());
+ stopWatch.fireEvent(StopWatch.EVENT_START);
+ assertEquals("running", stopWatch.getCurrentState());
+ stopWatch.fireEvent(StopWatch.EVENT_SPLIT);
+ assertEquals("paused", stopWatch.getCurrentState());
+ stopWatch.fireEvent(StopWatch.EVENT_UNSPLIT);
+ assertEquals("running", stopWatch.getCurrentState());
+ stopWatch.fireEvent(StopWatch.EVENT_STOP);
+ assertEquals("stopped", stopWatch.getCurrentState());
+ stopWatch.fireEvent(StopWatch.EVENT_RESET);
+ assertEquals("reset", stopWatch.getCurrentState());
+ }
+
+}
+
Propchange:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/StopWatchTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]