Просмотр исходного кода

#316 : trivial : improve test exec feedback

Johannes Dicks 10 лет назад
Родитель
Сommit
1d47a07958

+ 7 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/expressions/STextExpressionParser.java

@@ -49,6 +49,12 @@ public class STextExpressionParser implements IExpressionParser {
 			super(msg);
 		}
 	}
+	public static class SyntaxException extends RuntimeException{
+		private static final long serialVersionUID = 1L;
+		public SyntaxException(String msg) {
+			super(msg);
+		}
+	}
 
 	@Inject
 	private IParser parser;
@@ -109,7 +115,7 @@ public class STextExpressionParser implements IExpressionParser {
 				errorMessages.append(iNode.getSyntaxErrorMessage());
 				errorMessages.append("\n");
 			}
-			throw new RuntimeException("Could not parse expression, syntax errors: " + errorMessages);
+			throw new SyntaxException("Could not parse expression, syntax errors: " + errorMessages);
 		}
 		if (diagnosticsConsumer.hasConsumedDiagnostics(Severity.ERROR)) {
 			throw new LinkingException("Error during linking: " + diagnosticsConsumer.getResult(Severity.ERROR));

+ 1 - 2
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextScopeProviderTest.java

@@ -90,8 +90,7 @@ public class STextScopeProviderTest extends AbstractSTextTest {
 						statement, ruleName, scopes, isLinkable));
 		} catch (LinkingException e) {
 			if (isLinkable)
-				fail("Expected linkable but... '" + e.getMessage() + "'");
-			else if(e.getMessage().contains("Couldn't resolve reference to EObject"));
+				throw new RuntimeException("Expected linkable but : "+e.getMessage(),e);
 		}
 	}