Search in sources :

Example 41 with AssertableDiagnostics

use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.

the class STextJavaValidatorTest method checkAnnotationArguments.

/**
 * @see STextJavaValidator#checkAnnotationArguments(org.yakindu.sct.model.stext.stext.AnnotationDefinition)
 */
@Test
public void checkAnnotationArguments() {
    String scope = "@CycleBased";
    EObject model = super.parseExpression(scope, StatechartSpecification.class.getSimpleName());
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertError(STextJavaValidator.ERROR_WRONG_NUMBER_OF_ARGUMENTS_CODE);
    ;
    scope = "@EventDriven";
    model = super.parseExpression(scope, StatechartSpecification.class.getSimpleName());
    validationResult = tester.validate(model);
    validationResult.assertOK();
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) EObject(org.eclipse.emf.ecore.EObject) StatechartSpecification(org.yakindu.sct.model.stext.stext.StatechartSpecification) Test(org.junit.Test)

Example 42 with AssertableDiagnostics

use of org.eclipse.xtext.junit4.validation.AssertableDiagnostics in project statecharts by Yakindu.

the class TestModelsContainErrorsTest method testTestModelContainsErrors.

@Test
public void testTestModelContainsErrors() throws Exception {
    AssertableDiagnostics validate = tester.validate(statechart);
    // TODO: check warning in Choice.sct
    if (statechart.getName().equals("Choice"))
        return;
    assertTrue("Testmodel " + statechart.getName() + " contains validation diagnostics", Iterables.size(validate.getAllDiagnostics()) == 0);
}
Also used : AssertableDiagnostics(org.eclipse.xtext.junit4.validation.AssertableDiagnostics) Test(org.junit.Test)

Aggregations

AssertableDiagnostics (org.eclipse.xtext.junit4.validation.AssertableDiagnostics)42 Test (org.junit.Test)42 EObject (org.eclipse.emf.ecore.EObject)38 AbstractSGenTest (org.yakindu.sct.generator.genmodel.test.util.AbstractSGenTest)11 GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)11 InternalScope (org.yakindu.sct.model.stext.stext.InternalScope)7 Expression (org.yakindu.base.expressions.expressions.Expression)6 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)3 ReactionTrigger (org.yakindu.sct.model.stext.stext.ReactionTrigger)3 StatechartSpecification (org.yakindu.sct.model.stext.stext.StatechartSpecification)3 TransitionSpecification (org.yakindu.sct.model.stext.stext.TransitionSpecification)3 Scope (org.yakindu.sct.model.sgraph.Scope)2 ImportScope (org.yakindu.sct.model.stext.stext.ImportScope)2 ReactionEffect (org.yakindu.sct.model.stext.stext.ReactionEffect)2 Diagnostic (org.eclipse.emf.common.util.Diagnostic)1 Ignore (org.junit.Ignore)1