Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 232669 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ocl/uml/tests/IteratorsTest.java (+17 lines)
Lines 883-888 Link Here
883
        }
883
        }
884
    }
884
    }
885
885
886
    public void test_collect_ShortestCollect_Error() {
887
   	 	helper.setContext(getMetaclass("Package")); //$NON-NLS-1$
888
	   	try {             
889
	   		// should fail since nonIntegerProperty is not a property of Integer 
890
	        evaluate(helper, EcorePackage.eINSTANCE,
891
	            "let b:Integer = null in Bag{1, 2, 3}.nonIntegerProperty"); //$NON-NLS-1$
892
	        fail("Validation should have failed"); //$NON-NLS-1$
893
	    } catch (ParserException exc) {
894
	    	String excMessage = exc.getLocalizedMessage();
895
	    	if ( excMessage != null
896
	    		&& excMessage.equals("Unrecognized variable: (nonIntegerProperty)")) //$NON-NLS-1$
897
	    		System.out.println("Got expected error: " + exc.getLocalizedMessage()); //$NON-NLS-1$        	 
898
	    	else 
899
	    		fail("Unexpected exception: " + exc.getLocalizedMessage()); //$NON-NLS-1$
900
	    }
901
   }
902
886
    //
903
    //
887
    // Framework methods
904
    // Framework methods
888
    //
905
    //
(-)src/org/eclipse/ocl/ecore/tests/IteratorsTest.java (-2 / +19 lines)
Lines 772-779 Link Here
772
        } catch (Exception exc) {
772
        } catch (Exception exc) {
773
            fail("Failed to parse or evaluate: " + exc.getLocalizedMessage()); //$NON-NLS-1$
773
            fail("Failed to parse or evaluate: " + exc.getLocalizedMessage()); //$NON-NLS-1$
774
        }
774
        }
775
    }
775
    }   
776
776
    
777
    /**
777
    /**
778
     * Tests that when the body of an iterator results in OclInvalid, the entire
778
     * Tests that when the body of an iterator results in OclInvalid, the entire
779
     * iterator expression's value is OclInvalid.
779
     * iterator expression's value is OclInvalid.
Lines 1070-1075 Link Here
1070
            fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); //$NON-NLS-1$
1070
            fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); //$NON-NLS-1$
1071
        }
1071
        }
1072
    }
1072
    }
1073
    
1074
    public void test_collect_ShortestCollect_Error() {
1075
    	helper.setContext(EcorePackage.Literals.EPACKAGE);
1076
    	try {             
1077
            // should fail since nonIntegerProperty is not a property of Integer 
1078
            evaluate(helper, EcorePackage.eINSTANCE,
1079
                "let b:Integer = null in Bag{1, 2, 3}.nonIntegerProperty"); //$NON-NLS-1$
1080
            fail("Validation should have failed"); //$NON-NLS-1$
1081
        } catch (ParserException exc) {	      
1082
        	String excMessage = exc.getLocalizedMessage();
1083
	    	if ( excMessage != null
1084
	    		&& excMessage.equals("Unrecognized variable: (nonIntegerProperty)")) //$NON-NLS-1$
1085
	    		System.out.println("Got expected error: " + exc.getLocalizedMessage()); //$NON-NLS-1$        	 
1086
	    	else 
1087
	    		fail("Unexpected exception: " + exc.getLocalizedMessage()); //$NON-NLS-1$
1088
        }
1089
   }
1073
1090
1074
    //
1091
    //
1075
    // Framework methods
1092
    // Framework methods

Return to bug 232669