| /******************************************************************************* |
| * Copyright (c) 2006, 2018 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * E.D.Willink - Bug 296409 |
| *******************************************************************************/ |
| |
| package org.eclipse.ocl.ecore.tests; |
| |
| import org.eclipse.emf.ecore.EAttribute; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EClassifier; |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.EEnum; |
| import org.eclipse.emf.ecore.EEnumLiteral; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EOperation; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.EParameter; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.ocl.ecore.CallOperationAction; |
| import org.eclipse.ocl.ecore.Constraint; |
| import org.eclipse.ocl.ecore.SendSignalAction; |
| import org.eclipse.ocl.tests.GenericIteratorsTest; |
| |
| /** |
| * Tests for iterator expressions. |
| * |
| * @author Christian W. Damus (cdamus) |
| */ |
| @SuppressWarnings("nls") |
| public class IteratorsTest |
| extends GenericIteratorsTest<EObject, EPackage, EClassifier, EClassifier, EClass, EDataType, EClassifier, EEnum, EOperation, EParameter, EStructuralFeature, |
| EAttribute, EReference, EEnumLiteral, EObject, CallOperationAction, SendSignalAction, Constraint> { |
| |
| @Override |
| public EcoreTestReflection getStaticReflection() { |
| return EcoreTestReflection.INSTANCE; |
| } |
| |
| /** |
| * Test to check the validation of the <tt>sortedBy</tt> iterator, that |
| * the body expression type has a <tt><</tt> operation. |
| */ |
| @Override |
| public void test_sortedByRequiresComparability_192729() { |
| super.test_sortedByRequiresComparability_192729(); |
| EClassifier context = getMetaclass(denormalize("%Package")); |
| |
| // EDate defines '<' by having a Comparable instance class |
| assertQuery(context, "let dates : Sequence(%Date) = Sequence{} in dates->sortedBy(e | e)"); |
| } |
| } |