From e165b9f9a61bce34420e78f71ee2251638a94a7c Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Wed, 10 Feb 2016 13:46:10 +0000 Subject: [PATCH] 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 --- prism/src/parser/ast/Property.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/prism/src/parser/ast/Property.java b/prism/src/parser/ast/Property.java index d0912f2a..2f86ff6d 100644 --- a/prism/src/parser/ast/Property.java +++ b/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");