summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 13:11:22 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 13:11:22 +0000
commita6d1b69e97bdd7d018b7d7d5bfa3aca4124d56b8 (patch)
treebc247c3b91f236a25448ad2660e578883e549450 /java
parent16777aeb485d7d892a6e1fac8a603083c96c07a2 (diff)
Update error checking code to match the full error from the start and truncate to the right length
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
index 9658dfd0ad..d9a0dc0ac7 100644
--- a/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
+++ b/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
@@ -134,30 +134,33 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
return ContributionLocationHelper.getContributionLocation(testConfiguration.getTestClass());
} // end method getContributionLocation
- public void checkError(String testName, Throwable ex) throws Throwable {
+ public void checkError(String testName, Throwable ex) throws Throwable {
+
String expectedMessage = expectedErrorMessages.getProperty(testName);
String receivedMessage = ex.getMessage();
if (expectedMessage == null){
fail("Null expected error message for test " + testName +
"Please add message to oasis-sca-tests-errors.properties");
- }
+ } // end if
if (receivedMessage == null){
+ ex.printStackTrace();
fail("Null received error message for test " + testName);
- }
-
- int messageStart = receivedMessage.indexOf("] - ");
-
- if (messageStart < 0){
- fail("Message separator not found for test " + testName);
- }
+ } // end if
- receivedMessage = receivedMessage.substring(messageStart + 4);
+ // Deal with the case where the end of the message is variable (eg contains absolute filenames)
+ // and where the only relevant part is the start of the message - in this case the expected
+ // message only contains the stem section which is unchanging...
+ if( receivedMessage.length() > expectedMessage.length() ) {
+ // Truncate the received message to the length of the expected message
+ receivedMessage = receivedMessage.substring(0, expectedMessage.length() );
+ } // end if
assertEquals( expectedMessage, receivedMessage );
return;
+
}
} // end class TuscanyRuntimeBridge