Java Code Examples for org.eclipse.xtext.junit4.validation.AssertableDiagnostics#assertDiagnosticsCount()
The following examples show how to use
org.eclipse.xtext.junit4.validation.AssertableDiagnostics#assertDiagnosticsCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: STextValidatorTest.java From statecharts with Eclipse Public License 1.0 | 6 votes |
/** * @see STextValidator#checkEventDefinition(org.yakindu.sct.model.stext.stext.EventDefinition) */ @Test public void checkEventDefinition() { // No local declarations in interface scope EObject model = super.parseExpression("interface MyInterface: event Event1", InterfaceScope.class.getSimpleName()); AssertableDiagnostics result = tester.validate(model); result.assertErrorContains(LOCAL_DECLARATIONS); // No in declarations in internal scope model = super.parseExpression("internal: in event Event1", InternalScope.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); result.assertErrorContains(STextValidator.IN_OUT_DECLARATIONS); // No out declarations in internal scope model = super.parseExpression("internal: out event Event1", InternalScope.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); result.assertErrorContains(IN_OUT_DECLARATIONS); }
Example 2
Source File: STextValidatorTest.java From statecharts with Eclipse Public License 1.0 | 5 votes |
/** * @see STextValidator#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)); }
Example 3
Source File: STextValidatorTest.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Test public void checkConstAndReadOnlyDefinitionExpression() { String decl = "internal: const readonly v1:integer = 0"; EObject model = super.parseExpression(decl, InternalScope.class.getSimpleName()); AssertableDiagnostics result = tester.validate(model); result.assertDiagnosticsCount(1); result.assertWarningContains(String.format(STextValidator.DECLARATION_WITH_READONLY, "readonly", "const")); }
Example 4
Source File: SynchronizationValidatorTest.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Test public void synchronizationTransitionCount() { Statechart statechart = loadStatechart("SynchronizationTransitionCount.sct"); AssertableDiagnostics diagnostics = tester.validate(statechart); diagnostics.assertDiagnosticsCount(2); diagnostics.assertAny(errorCode(SYNCHRONIZATION_TRANSITIONS_REQUIRE_MULTIPLE_IN_OR_MULTIPLE_OUT_CODE)); }
Example 5
Source File: SynchronizationValidatorTest.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Test public void orthogonalTargetStates_StateInParentStateRegion() { Statechart statechart = loadStatechart("NotOrthogonalRegion01.sct"); AssertableDiagnostics diagnostics = tester.validate(statechart); diagnostics.assertDiagnosticsCount(2); diagnostics.assertAny(errorCode(SYNCHRONIZATION_REQUIRES_ORTHOGONAL_SOURCE_STATES_CODE)); diagnostics.assertAny(errorCode(SYNCHRONIZATION_REQUIRES_ORTHOGONAL_TARGET_STATES_CODE)); }
Example 6
Source File: SynchronizationValidatorTest.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Test public void orthogonalTargetStates_StateInTopLevelRegion() { Statechart statechart = loadStatechart("NotOrthogonalRegion02.sct"); AssertableDiagnostics diagnostics = tester.validate(statechart); diagnostics.assertDiagnosticsCount(2); diagnostics.assertAny(errorCode(SYNCHRONIZATION_REQUIRES_ORTHOGONAL_SOURCE_STATES_CODE)); diagnostics.assertAny(errorCode(SYNCHRONIZATION_REQUIRES_ORTHOGONAL_TARGET_STATES_CODE)); }
Example 7
Source File: CSGenJavaValidatorTest.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Test public void checkFeatureConfiguration() { EObject model = null; AssertableDiagnostics result = null; String start = "GeneratorModel for yakindu::c { statechart Example {"; model = parseExpression(start + "feature OutEventAPI {observables = false}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertAny( new MsgPredicate(String.format(CDefaultFeatureValueProvider.REQUIRED_TRUE_PARAMETER, "OutEventAPI"))); model = parseExpression(start + "feature OutEventAPI {observables = false getters = false}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertAny( new MsgPredicate(String.format(CDefaultFeatureValueProvider.REQUIRED_TRUE_PARAMETER, "OutEventAPI"))); model = parseExpression(start + " feature OutEventAPI {observables = true}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); model = parseExpression(start + "feature OutEventAPI {observables = true getters = true}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); model = parseExpression(start + "feature OutEventAPI {observables = true getters = false}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); model = parseExpression(start + "feature OutEventAPI {observables = false getters = true}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); model = parseExpression(start + "feature OutEventAPI {getters = true}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); model = parseExpression(start + "feature OutEventAPI {getters = false}}}", GeneratorModel.class.getSimpleName()); result = tester.validate(model); result.assertDiagnosticsCount(1); }