Community
Participate
Working Groups
}
public void test_collect_ShortestCollect_Error() {
helper.setContext(getMetaclass("Package")); //$NON-NLS-1$
try {
// should fail since nonIntegerProperty is not a property of Integer
evaluate(helper, EcorePackage.eINSTANCE,
"let b:Integer = null in Bag{1, 2, 3}.nonIntegerProperty"); //$NON-NLS-1$
fail("Validation should have failed"); //$NON-NLS-1$
} catch (ParserException exc) {
String excMessage = exc.getLocalizedMessage();
if ( excMessage != null
&& excMessage.equals("Unrecognized variable: (nonIntegerProperty)")) //$NON-NLS-1$
System.out.println("Got expected error: " + exc.getLocalizedMessage()); //$NON-NLS-1$
else
fail("Unexpected exception: " + exc.getLocalizedMessage()); //$NON-NLS-1$
//
// Framework methods
} catch (Exception exc) {
fail("Failed to parse or evaluate: " + exc.getLocalizedMessage()); //$NON-NLS-1$
/**
* Tests that when the body of an iterator results in OclInvalid, the entire
* iterator expression's value is OclInvalid.
fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); //$NON-NLS-1$
helper.setContext(EcorePackage.Literals.EPACKAGE);