Browse Source

refactor testing against PrismNotSupportedException

If the expected result specified via // RESULT
is an error, we treat a PrismNotSupportedException just
as any other ordinary exception. This allows verifying
the content of a PrismNotSupportedException error message.
Otherwise, we do the usual special handling as before.


git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11173 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 10 years ago
parent
commit
e165b9f9a6
  1. 9
      prism/src/parser/ast/Property.java

9
prism/src/parser/ast/Property.java

@ -260,13 +260,10 @@ public class Property extends ASTElement
}
// Check for exceptions
if (result instanceof PrismNotSupportedException) {
// not supported -> handle in caller
throw (PrismNotSupportedException)result;
}
if (result instanceof Exception) {
String errMsg = ((Exception) result).getMessage();
if (strExpected.startsWith("Error")) {
// handle expected errors
if (strExpected.startsWith("Error:")) {
String words[] = strExpected.substring(6).split(",");
for (String word : words) {
@ -280,6 +277,10 @@ public class Property extends ASTElement
}
return true;
}
if (result instanceof PrismNotSupportedException) {
// not supported -> handle in caller
throw (PrismNotSupportedException)result;
}
throw new PrismException("Unexpected error: " + errMsg);
} else if (strExpected.startsWith("Error")) {
throw new PrismException("Was expecting an error");

Loading…
Cancel
Save