|
Lines 1-7
Link Here
|
| 1 |
/** |
1 |
/** |
| 2 |
* <copyright> |
2 |
* <copyright> |
| 3 |
* |
3 |
* |
| 4 |
* Copyright (c) 2005, 2008 IBM Corporation and others. |
4 |
* Copyright (c) 2005, 2008 IBM Corporation, Zeligsoft Inc. and others. |
| 5 |
* All rights reserved. This program and the accompanying materials |
5 |
* All rights reserved. This program and the accompanying materials |
| 6 |
* are made available under the terms of the Eclipse Public License v1.0 |
6 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 7 |
* which accompanies this distribution, and is available at |
7 |
* which accompanies this distribution, and is available at |
|
Lines 31-36
Link Here
|
| 31 |
import junit.framework.TestSuite; |
31 |
import junit.framework.TestSuite; |
| 32 |
|
32 |
|
| 33 |
import org.eclipse.emf.common.util.BasicEList; |
33 |
import org.eclipse.emf.common.util.BasicEList; |
|
|
34 |
import org.eclipse.emf.common.util.Diagnostic; |
| 34 |
import org.eclipse.emf.common.util.EList; |
35 |
import org.eclipse.emf.common.util.EList; |
| 35 |
import org.eclipse.emf.common.util.URI; |
36 |
import org.eclipse.emf.common.util.URI; |
| 36 |
import org.eclipse.emf.ecore.EFactory; |
37 |
import org.eclipse.emf.ecore.EFactory; |
|
Lines 48-57
Link Here
|
| 48 |
import org.eclipse.ocl.helper.Choice; |
49 |
import org.eclipse.ocl.helper.Choice; |
| 49 |
import org.eclipse.ocl.helper.ChoiceKind; |
50 |
import org.eclipse.ocl.helper.ChoiceKind; |
| 50 |
import org.eclipse.ocl.helper.OCLHelper; |
51 |
import org.eclipse.ocl.helper.OCLHelper; |
|
|
52 |
import org.eclipse.ocl.lpg.ProblemHandler; |
| 53 |
import org.eclipse.ocl.parser.OCLProblemHandler; |
| 51 |
import org.eclipse.ocl.types.OCLStandardLibrary; |
54 |
import org.eclipse.ocl.types.OCLStandardLibrary; |
| 52 |
import org.eclipse.ocl.uml.ExpressionInOCL; |
55 |
import org.eclipse.ocl.uml.ExpressionInOCL; |
| 53 |
import org.eclipse.ocl.uml.OCL; |
56 |
import org.eclipse.ocl.uml.OCL; |
| 54 |
import org.eclipse.ocl.uml.util.OCLUMLUtil; |
57 |
import org.eclipse.ocl.uml.util.OCLUMLUtil; |
|
|
58 |
import org.eclipse.ocl.util.OCLUtil; |
| 55 |
import org.eclipse.ocl.utilities.Visitable; |
59 |
import org.eclipse.ocl.utilities.Visitable; |
| 56 |
import org.eclipse.uml2.uml.Association; |
60 |
import org.eclipse.uml2.uml.Association; |
| 57 |
import org.eclipse.uml2.uml.AssociationClass; |
61 |
import org.eclipse.uml2.uml.AssociationClass; |
|
Lines 660-665
Link Here
|
| 660 |
assertNull("Choice found: " + name + ", " + kind, //$NON-NLS-1$ //$NON-NLS-2$ |
664 |
assertNull("Choice found: " + name + ", " + kind, //$NON-NLS-1$ //$NON-NLS-2$ |
| 661 |
findChoice(choices, kind, name)); |
665 |
findChoice(choices, kind, name)); |
| 662 |
} |
666 |
} |
|
|
667 |
|
| 668 |
/** |
| 669 |
* Asserts that a exception of the specified kind is not signalled by |
| 670 |
* the a given diagnostic or (recursively) its children. |
| 671 |
* |
| 672 |
* @param diagnostic a diagnostic |
| 673 |
* @param excType an exception that must not be indicated by the diagnostic |
| 674 |
* |
| 675 |
* @since 1.2 |
| 676 |
*/ |
| 677 |
protected void assertNoException(Diagnostic diagnostic, java.lang.Class<? extends Throwable> excType) { |
| 678 |
if (excType.isInstance(diagnostic.getException())) { |
| 679 |
fail("Diagnostic signals a(n) " + excType.getSimpleName()); //$NON-NLS-1$ |
| 680 |
} |
| 681 |
|
| 682 |
for (Diagnostic nested : diagnostic.getChildren()) { |
| 683 |
assertNoException(nested, excType); |
| 684 |
} |
| 685 |
} |
| 686 |
|
| 687 |
/** |
| 688 |
* Obtains the diagnostic describing the problem in the last failed parse, |
| 689 |
* asserting that it is not <code>null</code>. |
| 690 |
* |
| 691 |
* @return the diagnostic |
| 692 |
*/ |
| 693 |
protected Diagnostic getDiagnostic() { |
| 694 |
OCLProblemHandler handler = (OCLProblemHandler) OCLUtil.getAdapter( |
| 695 |
ocl.getEnvironment(), ProblemHandler.class); |
| 696 |
|
| 697 |
Diagnostic result = handler.getDiagnostic(); |
| 698 |
if (result == null) { |
| 699 |
result = helper.getProblems(); |
| 700 |
} |
| 701 |
|
| 702 |
assertNotNull("No diagnostic", result); //$NON-NLS-1$ |
| 703 |
|
| 704 |
return result; |
| 705 |
} |
| 663 |
|
706 |
|
| 664 |
protected OCLStandardLibrary<Classifier> getOCLStandardLibrary() { |
707 |
protected OCLStandardLibrary<Classifier> getOCLStandardLibrary() { |
| 665 |
return ocl.getEnvironment().getOCLStandardLibrary(); |
708 |
return ocl.getEnvironment().getOCLStandardLibrary(); |