summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/stest
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-03-26 13:46:56 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-03-26 13:46:56 +0000
commit96255e64710efbb00edb4360ed5a69bd0b9791c5 (patch)
tree50743c5620b50dd88dc0f6e130e1d59bd6338b68 /branches/sca-java-1.x/stest
parente01c635e7679ffda1db49739993eccc406537a07 (diff)
Example of how we could describe what exceptions are expected in stests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@758644 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/stest')
-rw-r--r--branches/sca-java-1.x/stest/sampleTest/src/test/java/client/ASM_0004_TestCase.java4
-rw-r--r--branches/sca-java-1.x/stest/sampleTest/src/test/java/client/BaseTestCase.java7
2 files changed, 8 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/ASM_0004_TestCase.java b/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/ASM_0004_TestCase.java
index 84ab959a67..cafa6d25c3 100644
--- a/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/ASM_0004_TestCase.java
+++ b/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/ASM_0004_TestCase.java
@@ -32,7 +32,7 @@ public class ASM_0004_TestCase extends BaseJAXWSTestCase {
TestConfiguration config = new TestConfiguration();
config.testName = "ASM_0004";
config.input = "request";
- config.output = "exception";
+ config.output = "org.osoa.sca.ServiceRuntimeException: Too many targets on reference: reference1";
config.composite = "Test_ASM_0004.composite";
config.testServiceName = "TestClient";
config.testClass = ASM_0002_Client.class;
@@ -40,4 +40,4 @@ public class ASM_0004_TestCase extends BaseJAXWSTestCase {
return config;
}
-} // end class Test_ASM_0003
+} // end class Test_ASM_0004
diff --git a/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/BaseTestCase.java b/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/BaseTestCase.java
index 95bfade555..e39a8bf7e9 100644
--- a/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/BaseTestCase.java
+++ b/branches/sca-java-1.x/stest/sampleTest/src/test/java/client/BaseTestCase.java
@@ -20,6 +20,7 @@ package client;
import static org.junit.Assert.*;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -62,7 +63,11 @@ public class BaseTestCase {
// If the SCA runtime refuses to start an invalid contribution, then this is also
// regarded as a successful outcome
System.out.println( "Exception received - detail: " + e.getMessage() );
- assertEquals( testConfiguration.getExpectedOutput(), "exception" );
+ if (e.getCause() instanceof InvocationTargetException){
+ assertEquals( testConfiguration.getExpectedOutput(), ((InvocationTargetException)e.getCause()).getCause().getMessage() );
+ } else {
+ assertEquals( testConfiguration.getExpectedOutput(), "exception" );
+ }
System.out.println("Test " + testConfiguration.getTestName() + " completed successfully");
// Mark this test as not to proceed further
proceed = false;