Java 类org.eclipse.xtext.junit4.validation.AssertableDiagnostics 实例源码

项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkNoAssignmentInGuard() {
    String scope = "internal: var myInt : integer var myBool : boolean = true";
    EObject expression = super.parseExpression("[myBool = false]", ReactionTrigger.class.getSimpleName(), scope);
    AssertableDiagnostics validationResult = tester.validate(expression);
    validationResult.assertErrorContains(STextJavaValidator.GUARD_CONTAINS_ASSIGNMENT);

    expression = super.parseExpression("[myInt = 5]", ReactionTrigger.class.getSimpleName(), scope);
    validationResult = tester.validate(expression);
    Iterator<Diagnostic> diag = validationResult.getAllDiagnostics().iterator();
    while (diag.hasNext()) {
        Diagnostic d = diag.next();
        if (d.getMessage().equals(GUARD_EXPRESSION)) {
            assertEquals(STextJavaValidator.GUARD_EXPRESSION, d.getMessage());
        } else {
            assertEquals(STextJavaValidator.GUARD_CONTAINS_ASSIGNMENT, d.getMessage());
        }
    }

}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * 
 * @see STextJavaValidator#checkReactionTrigger(org.yakindu.sct.model.stext.stext.ReactionTrigger)
 */
@Test
public void checkReactionTrigger() {
    // ENTRY, EXIT not allowed in transitions
    String scope = "internal : event a : integer var myVar : integer";
    EObject model = super.parseExpression("entry / myVar = 5", TransitionSpecification.class.getSimpleName(),
            scope);
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertError(ENTRY_EXIT_TRIGGER_NOT_ALLOWED);

    model = super.parseExpression("exit / myVar = 5", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(ENTRY_EXIT_TRIGGER_NOT_ALLOWED);

    model = super.parseExpression("oncycle / myVar = 5", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();

    model = super.parseExpression("always / myVar = 5", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkReactionTriggerRegularEvent() {

    String scope = "interface : in event e  var x : integer  var y : integer  operation op():integer";

    EObject model = super.parseExpression("e", TransitionSpecification.class.getSimpleName(), scope);
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertOK();

    model = super.parseExpression("x", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(TRIGGER_IS_NO_EVENT);

    model = super.parseExpression("e, x", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(TRIGGER_IS_NO_EVENT);

    model = super.parseExpression("op()", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(TRIGGER_IS_NO_EVENT);

    model = super.parseExpression("x, y", TransitionSpecification.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertAll(errorMsg("Trigger 'x' is no event."), errorMsg("Trigger 'y' is no event."));

}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @see STextJavaValidator#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(STextJavaValidator.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);
}
项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkValueOfNoEvent() {
    String decl = "interface: in event e1:integer var x:integer operation op():integer interface i: in event e2:integer var y:integer";

    EObject model = super.parseExpression("valueof(e1)", Expression.class.getSimpleName(), decl);
    AssertableDiagnostics result = tester.validate(model);
    result.assertOK();

    model = super.parseExpression("valueof(i.e2)", Expression.class.getSimpleName(), decl);
    result = tester.validate(model);
    result.assertOK();

    model = super.parseExpression("valueof(x)", Expression.class.getSimpleName(), decl);
    result = tester.validate(model);
    result.assertError(VALUE_OF_REQUIRES_EVENT);

    model = super.parseExpression("valueof(i.y)", Expression.class.getSimpleName(), decl);
    result = tester.validate(model);
    result.assertError(VALUE_OF_REQUIRES_EVENT);

    model = super.parseExpression("valueof(op())", Expression.class.getSimpleName(), decl);
    result = tester.validate(model);
    result.assertError(VALUE_OF_REQUIRES_EVENT);

}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkDeprecatedFeatures(GeneratorEntry)
 */
@Test
public void checkDeprecatedFeatures() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet {targetFolder = \"src-gen\"  targetProject = \"TestProject\" }}}",
            GeneratorModel.class.getSimpleName());
    if (!(model instanceof GeneratorModel)) {
        fail("Model is of the wrong type");
    } else {
        GeneratorModel genModel = (GeneratorModel) model;
        genModel.getEntries().get(0).getFeatures().get(0).getType()
                .setDeprecated(true);
        AssertableDiagnostics result = tester.validate(genModel);
        result.assertAny(new MsgPredicate(DEPRECATED));
    }
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkDeprecatedParameters(GeneratorEntry)
 */
@Test
public void checkDeprecatedParameters() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet {targetFolder = \"src-gen\"  targetProject = \"TestProject\" }}}",
            GeneratorModel.class.getSimpleName());
    if (!(model instanceof GeneratorModel)) {
        fail("Model is of the wrong type");
    } else {
        GeneratorModel genModel = (GeneratorModel) model;
        genModel.getEntries().get(0).getFeatures().get(0).getType()
                .getParameters().get(0).setDeprecated(true);
        AssertableDiagnostics result = tester.validate(genModel);
        result.assertAny(new MsgPredicate(DEPRECATED));
    }
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testRuleConclusionNotSubtypeBoth() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testRuleWithConclusionNotSubtypeBoth());
    validate.assertAll(
            AssertableDiagnostics
                    .error(NOT_SUBTYPE,
                            "Rule conclusion type EObject "
                                    + "is not subtype of JudgmentDescription declared type "
                                    + "EClass"),
            AssertableDiagnostics
                    .error(NOT_SUBTYPE,
                            "Rule conclusion type String "
                                    + "is not subtype of JudgmentDescription declared type "
                                    + "EObject"));
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @see STextJavaValidator#checkVariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition)
 */
@Test
public void checkVariableDefinition() {
    Scope context = (Scope) parseExpression("interface if : var i : void", InterfaceScope.class.getSimpleName());
    AssertableDiagnostics validationResult = tester.validate(context);
    validationResult.assertErrorContains(STextTypeInferrer.VARIABLE_VOID_TYPE);
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 *  
 * @see STextJavaValidator#checkAssignmentExpression(org.yakindu.sct.model.stext.stext.AssignmentExpression)
 */
@Test
public void checkAssignmentExpression() {

    String context = "interface: var i : integer = 42 var j : integer =23";

    EObject expression = super.parseExpression("i += (i+=3) +4", Expression.class.getSimpleName(), context);
    AssertableDiagnostics validationResult = tester.validate(expression);
    validationResult.assertErrorContains(STextJavaValidator.ASSIGNMENT_EXPRESSION);

    expression = super.parseExpression("i += (j+=3) +4", Expression.class.getSimpleName(), context);
    validationResult = tester.validate(expression);
    validationResult.assertOK();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkLeftHandAssignment() {

    String scope = "interface if : operation myOperation() : boolean event Event1 : boolean var myVar : boolean";

    EObject model = super.parseExpression("3 = 3", Expression.class.getSimpleName(), scope);
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertErrorContains(ERROR_LEFT_HAND_ASSIGNMENT_MSG);

    // Check for referenced elements in interface
    model = super.parseExpression("if.myOperation() = true", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertErrorContains(ERROR_LEFT_HAND_ASSIGNMENT_MSG);

    model = super.parseExpression("if.Event1 = true", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertErrorContains(ERROR_LEFT_HAND_ASSIGNMENT_MSG);

    model = super.parseExpression("if.myVar = true", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();

    // check for internal referenced elements
    scope = "internal : operation myOperation() : integer event Event1 : integer var myVar : integer";

    model = super.parseExpression("myOperation() = 5", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertErrorContains(ERROR_LEFT_HAND_ASSIGNMENT_MSG);

    model = super.parseExpression("Event1 = true", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertErrorContains(ERROR_LEFT_HAND_ASSIGNMENT_MSG);

    model = super.parseExpression("myVar = 5", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();

}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @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();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @see STextJavaValidator#checkOperationArguments_TypedElementReferenceExpression(TypedElementReferenceExpression)
 */
@Test
public void checkOperationArguments_TypedElementReferenceExpression() {
    String scope = "internal: operation myOperation(param1 : integer, param2: boolean)";
    EObject model = super.parseExpression("myOperation(5,true)", Expression.class.getSimpleName(), scope);
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertOK();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkOperationNamedParameters() {
    String scope = "internal: operation myOperation(param1 : integer, param2 : boolean)";
    EObject model = super.parseExpression(scope, InternalScope.class.getSimpleName());
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertOK();

    model = super.parseExpression("myOperation(5, true)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();
    model = super.parseExpression("myOperation(5, param2 = true)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();
    model = super.parseExpression("myOperation(param1 = 5, true)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();
    model = super.parseExpression("myOperation(param1 = 5, param2 = true)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();
    model = super.parseExpression("myOperation(param2 = true, param1 = 5)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertOK();

    model = super.parseExpression("myOperation(param2 = true)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(ERROR_WRONG_NUMBER_OF_ARGUMENTS_CODE);

    model = super.parseExpression("myOperation(param1 = 5)", Expression.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertError(ERROR_WRONG_NUMBER_OF_ARGUMENTS_CODE);

}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @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();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @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();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @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();
}
项目:statecharts    文件:STextJavaValidatorTest.java   
@Test
public void checkRaisingExpressionEvent() {

    String scope = "interface : in event e  var x : integer  var y : integer  operation op():integer";

    EObject model = super.parseExpression("raise e", ReactionEffect.class.getSimpleName(), scope);
    AssertableDiagnostics validationResult = tester.validate(model);
    validationResult.assertOK();

    model = super.parseExpression("raise y", ReactionEffect.class.getSimpleName(), scope);
    validationResult = tester.validate(model);
    validationResult.assertAll(errorMsg("'y' is not an event."));
}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @see STextJavaValidator#checkReactionEffectActions(org.yakindu.sct.model.stext.stext.ReactionEffect)
 */
@Test
public void checkReactionEffectActions() {
    String s1 = "internal : var a : integer event e operation o () : void";
    String s2 = "interface if : var a : integer in event e operation o()";

    EObject model = super.parseExpression("a", ReactionEffect.class.getSimpleName(), s1);
    AssertableDiagnostics result = tester.validate(model);
    result.assertError(FEATURE_CALL_HAS_NO_EFFECT);

    model = super.parseExpression("1+3", ReactionEffect.class.getSimpleName(), s1);
    result = tester.validate(model);
    result.assertError(FEATURE_CALL_HAS_NO_EFFECT);

    model = super.parseExpression("valueof(e)", ReactionEffect.class.getSimpleName(), s1);
    result = tester.validate(model);
    result.assertError(FEATURE_CALL_HAS_NO_EFFECT);

    model = super.parseExpression("o()", ReactionEffect.class.getSimpleName(), s1);
    result = tester.validate(model);
    result.assertOK();

    model = super.parseExpression("if.a", ReactionEffect.class.getSimpleName(), s2);
    result = tester.validate(model);
    result.assertError(FEATURE_CALL_HAS_NO_EFFECT);

    model = super.parseExpression("valueof(if.e)", ReactionEffect.class.getSimpleName(), s2);
    result = tester.validate(model);
    result.assertError(FEATURE_CALL_HAS_NO_EFFECT);

    model = super.parseExpression("if.o", ReactionEffect.class.getSimpleName(), s2);
    result = tester.validate(model);
    result.assertOK();

}
项目:statecharts    文件:STextJavaValidatorTest.java   
/**
 * @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));
}
项目:statecharts    文件:TestModelsContainErrorsTest.java   
@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);
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkContentType(org.yakindu.sct.model.sgen.GeneratorEntry)
 */
@Test
public void checkContentType() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { unkownType Example {}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(UNKNOWN_CONTENT_TYPE));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
@Test
public void checkInitialValue() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { var x : boolean = 5 }",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate("Incompatible types boolean and integer."));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkParameterValueType(org.yakindu.sct.model.sgen.FeatureParameterValue)
 * 
 */
@Test
public void checkParameterValueType() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet { targetFolder = true }}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate("Incompatible types string and boolean."));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkGeneratorExists(GeneratorModel)
 */
@Test
public void checkGeneratorExists() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::unknown {}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(UNKOWN_GENERATOR));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkDuplicateGeneratorEntryFeature(FeatureConfiguration)
 */
@Test
public void checkDuplicateGeneratorEntryFeature() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet { } feature Outlet { }}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(DUPLICATE_FEATURE));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkDuplicateFeatureParameter(org.yakindu.sct.model.sgen.FeatureParameterValue)
 */
@Test
public void checkDuplicateFeatureParameter() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet { targetFolder = true  targetFolder = true }}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(DUPLICATE_PARAMETER));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkRequiredFeatures(org.yakindu.sct.model.sgen.GeneratorEntry)
 */
@Test
public void checkRequiredFeatures() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example {}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(MISSING_REQUIRED_FEATURE));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkRequiredParameters(FeatureConfiguration)
 */
@Test
public void checkRequiredParameters() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java { statechart Example { feature Outlet {}}}",
            GeneratorModel.class.getSimpleName());
    AssertableDiagnostics result = tester.validate(model);
    result.assertAny(new MsgPredicate(MISSING_REQUIRED_PARAMETER));
}
项目:statecharts    文件:SGenJavaValidatorTest.java   
/**
 * @see SGenJavaValidator#checkDeprecatedParameters(GeneratorEntry)
 */
@Test
public void checkEntriesExist() {
    EObject model = parseExpression(
            "GeneratorModel for yakindu::java {}",
            GeneratorModel.class.getSimpleName());
    if (!(model instanceof GeneratorModel)) {
        fail("Model is of the wrong type");
    } else {
        GeneratorModel genModel = (GeneratorModel) model;
        AssertableDiagnostics result = tester.validate(genModel);
        result.assertAny(new MsgPredicate(EMPTY_SGEN));
    }
}
项目:xsemantics    文件:FjAbstractGeneratedValidatorTests.java   
protected void assertOk(AssertableDiagnostics validate) {
    if (listOfDiagnostics(validate).size() != 0) {
        System.err.println(utils.diagnosticsToString(validate));
        fail("There are expected to be no diagnostics.: "
                + utils.diagnosticsToString(validate));
    }
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testDuplicateJudgmentDescriptionSymbols() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testJudgmentDescriptionsWithDuplicateSymbols());
    String messageFragment = "Duplicate judgment symbols '|- :'";
    validate.assertAll(AssertableDiagnostics.error(
            DUPLICATE_JUDGMENT_DESCRIPTION_SYMBOLS,
            messageFragment), AssertableDiagnostics.error(
            DUPLICATE_JUDGMENT_DESCRIPTION_SYMBOLS,
            messageFragment));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
protected void assertContains(AssertableDiagnostics validate, String string) {
    final String diagnosticsToString = diagnosticsToString(validate);
    if (!diagnosticsToString.contains(string)) {
        fail("diagnostics: " + diagnosticsToString
                + "\n does not contain: " + string);
    }
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testRulesWithExpressionInConclusionWrong() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testRuleWithExpressionInConclusion2());
    validate.assertAll(AssertableDiagnostics.error(
            NOT_PARAMETER,
            "Must be a parameter, not an expression"));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testNoRuleForJudgmentDescription() throws Exception {
    validator.setEnableWarnings(true);
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testJudgmentDescriptions());
    validate.assertAll(AssertableDiagnostics
            .warningMsg("No rule defined for the judgment description"));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
protected void assertNoJudgmentDescription(CharSequence programString)
        throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(programString);
    String messageFragment = "No Judgment description for: ||- :";
    validate.assertAll(AssertableDiagnostics.error(
            NO_JUDGMENT_DESCRIPTION, messageFragment));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testRulesOfTheSameKindWithSameInputArgumentTypes()
        throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testRulesOfTheSameKindWithSameInputArgumentTypes());
    validate.assertAll(AssertableDiagnostics.error(
            DUPLICATE_RULE_WITH_SAME_ARGUMENTS,
            "Duplicate rule of the same kind with parameters: String"
                    + IN_SYSTEM_ORG_ECLIPSE_XSEMANTICS_TEST_TYPE_SYSTEM),
            AssertableDiagnostics.error(
                    DUPLICATE_RULE_WITH_SAME_ARGUMENTS,
                    "Duplicate rule of the same kind with parameters: String"
                            + IN_SYSTEM_ORG_ECLIPSE_XSEMANTICS_TEST_TYPE_SYSTEM));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testMoreThan3OutputParams() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testJudgmentDescriptionsWith4OutputParams());
    validate.assertAll(AssertableDiagnostics.error(
            TOO_MANY_OUTPUT_PARAMS,
            "No more than 3 output parameters are handled at the moment"));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testNoInputParam() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testJudgmentDescriptionsWithNoInputParam());
    validate.assertAll(AssertableDiagnostics.error(
            NO_INPUT_PARAM,
            "No input parameter; at least one is needed"));
}
项目:xsemantics    文件:XsemanticsValidatorTests.java   
@Test
public void testAssignmentToInputParam() throws Exception {
    AssertableDiagnostics validate = loadModelAndValidate(testFiles
            .testRuleWithAssignmentToInputParam());
    validate.assertAll(AssertableDiagnostics.error(
            ASSIGNMENT_TO_INPUT_PARAM,
            "Assignment to input parameter"));
}