Author: sebb
Date: Fri Jan 2 07:40:41 2009
New Revision: 730758
URL: http://svn.apache.org/viewvc?rev=730758&view=rev
Log:
SCXML-91 (1) - Test cases should only catch Exception if that is part of the
test
Modified:
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeTest.java
Modified:
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeTest.java?rev=730758&r1=730757&r2=730758&view=diff
==============================================================================
---
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeTest.java
(original)
+++
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeTest.java
Fri Jan 2 07:40:41 2009
@@ -80,65 +80,49 @@
/**
* Test the SCXML documents, usage of <invoke>
*/
- public void testInvoke01Sample() {
- try {
- SCXML scxml = SCXMLParser.parse(invoke01,
- new SimpleErrorHandler());
- exec = new SCXMLExecutor(new JexlEvaluator(), new
SimpleDispatcher(),
- new SimpleErrorReporter());
- assertNotNull(exec);
- exec.setRootContext(new JexlContext());
- exec.setStateMachine(scxml);
- exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
- exec.go();
- Set currentStates = exec.getCurrentStatus().getStates();
- assertEquals(1, currentStates.size());
- assertEquals("invoker", ((State)currentStates.iterator().
- next()).getId());
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ public void testInvoke01Sample() throws Exception {
+ SCXML scxml = SCXMLParser.parse(invoke01,
+ new SimpleErrorHandler());
+ exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(),
+ new SimpleErrorReporter());
+ assertNotNull(exec);
+ exec.setRootContext(new JexlContext());
+ exec.setStateMachine(scxml);
+ exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
+ exec.go();
+ Set currentStates = exec.getCurrentStatus().getStates();
+ assertEquals(1, currentStates.size());
+ assertEquals("invoker",
((State)currentStates.iterator().next()).getId());
}
- public void testInvoke02Sample() {
- try {
- SCXML scxml = SCXMLParser.parse(invoke02,
- new SimpleErrorHandler());
- exec = new SCXMLExecutor(new JexlEvaluator(), new
SimpleDispatcher(),
- new SimpleErrorReporter());
- assertNotNull(exec);
- exec.setRootContext(new JexlContext());
- exec.setStateMachine(scxml);
- exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
- exec.go();
- Set currentStates = exec.getCurrentStatus().getStates();
- assertEquals(1, currentStates.size());
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ public void testInvoke02Sample() throws Exception {
+ SCXML scxml = SCXMLParser.parse(invoke02,
+ new SimpleErrorHandler());
+ exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(),
+ new SimpleErrorReporter());
+ assertNotNull(exec);
+ exec.setRootContext(new JexlContext());
+ exec.setStateMachine(scxml);
+ exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
+ exec.go();
+ Set currentStates = exec.getCurrentStatus().getStates();
+ assertEquals(1, currentStates.size());
}
- public void testInvoke03Sample() {
- try {
- SCXML scxml = SCXMLParser.parse(invoke03,
- new SimpleErrorHandler());
- exec = new SCXMLExecutor(new JexlEvaluator(), new
SimpleDispatcher(),
- new SimpleErrorReporter());
- assertNotNull(exec);
- exec.setRootContext(new JexlContext());
- exec.setStateMachine(scxml);
- exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
- exec.go();
- Set currentStates = exec.getCurrentStatus().getStates();
- assertEquals(1, currentStates.size());
- SCXMLTestHelper.fireEvent(exec, "s1.next");
- SCXMLTestHelper.fireEvent(exec, "state1.next");
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ public void testInvoke03Sample() throws Exception {
+ SCXML scxml = SCXMLParser.parse(invoke03,
+ new SimpleErrorHandler());
+ exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(),
+ new SimpleErrorReporter());
+ assertNotNull(exec);
+ exec.setRootContext(new JexlContext());
+ exec.setStateMachine(scxml);
+ exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
+ exec.go();
+ Set currentStates = exec.getCurrentStatus().getStates();
+ assertEquals(1, currentStates.size());
+ SCXMLTestHelper.fireEvent(exec, "s1.next");
+ SCXMLTestHelper.fireEvent(exec, "state1.next");
}
public static void main(String args[]) {