use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkReadOnlyValueDefinitionExpression.
@Test
public void checkReadOnlyValueDefinitionExpression() {
String decl = "internal: var readonly v1:integer";
EObject model = super.parseExpression(decl, InternalScope.class.getSimpleName());
AssertableDiagnostics result = tester.validate(model);
result.assertDiagnosticsCount(1);
result.assertWarningContains(String.format(STextJavaValidator.DECLARATION_DEPRECATED, "readonly"));
}
use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkOperationArguments_FeatureCall.
/**
* @see STextJavaValidator#checkOperationArguments_FeatureCall(org.yakindu.sct.model.stext.stext.FeatureCall)
*/
@Test
public void checkOperationArguments_FeatureCall() {
String scope = "interface if : operation myOperation(param1 : integer, param2: boolean";
EObject model = super.parseExpression("if.myOperation(5,true)", Expression.class.getSimpleName(), scope);
AssertableDiagnostics validationResult = tester.validate(model);
validationResult.assertOK();
}
use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkGuard.
/**
* @see STextJavaValidator#checkGuardHasBooleanExpression(org.yakindu.sct.model.stext.stext.ReactionTrigger)
*/
@Test
public void checkGuard() {
EObject expression = super.parseExpression("[3 * 3]", ReactionTrigger.class.getSimpleName());
AssertableDiagnostics validationResult = tester.validate(expression);
validationResult.assertErrorContains(STextJavaValidator.GUARD_EXPRESSION);
String scope = "internal: var myInt : integer var myBool : boolean = true";
expression = super.parseExpression("[myInt <= 5 || !myBool ]", ReactionTrigger.class.getSimpleName(), scope);
validationResult = tester.validate(expression);
validationResult.assertOK();
}
use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkFeatureCall.
/**
* @see STextJavaValidator#checkFeatureCall(org.yakindu.sct.model.stext.stext.FeatureCall)
* @see STextJavaValidator#checkFeatureCall(TypedElementReferenceExpression)
*/
@Test
public void checkFeatureCall() {
String scope = "interface if : in event a : integer";
EObject model = super.parseExpression("if.a / raise if.a:1", TransitionSpecification.class.getSimpleName(), scope);
AssertableDiagnostics validationResult = tester.validate(model);
validationResult.assertOK();
}
use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkInterfaceScope.
/**
* @see STextJavaValidator#checkInterfaceScope(Statechart)
*/
@Test
public void checkInterfaceScope() {
EObject model = super.parseExpression("interface: in event event1 interface: in event event2", StatechartSpecification.class.getSimpleName());
AssertableDiagnostics result = tester.validate(model);
result.assertDiagnosticsCount(2);
result.assertAll(errorCode(ONLY_ONE_INTERFACE), errorCode(ONLY_ONE_INTERFACE));
}
Aggregations