Author: slaws
Date: Mon Oct 5 13:11:22 2009
New Revision: 821785
URL: http://svn.apache.org/viewvc?rev=821785&view=rev
Log:
Update error checking code to match the full error from the start and truncate
to the right length
Modified:
tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
Modified:
tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java?rev=821785&r1=821784&r2=821785&view=diff
==============================================================================
---
tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
(original)
+++
tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
Mon Oct 5 13:11:22 2009
@@ -134,30 +134,33 @@
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);
- }
+ } // end if
- int messageStart = receivedMessage.indexOf("] - ");
-
- if (messageStart < 0){
- fail("Message separator not found for test " + testName);
- }
-
- 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