| Summary: | Regression - bug in OCLAbstractAnalyzer | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] OCL | Reporter: | Adolfo Sanchez-Barbudo Herrera <adolfosbh> | ||||||
| Component: | Core | Assignee: | Christian Damus <give.a.damus> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | critical | ||||||||
| Priority: | P1 | ||||||||
| Version: | 1.2.0 | ||||||||
| Target Milestone: | RC | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Adolfo Sanchez-Barbudo Herrera
Created attachment 100784 [details]
Fix with different test approach
A fix, with a different approach to testing the problem. I use the fact that a "normal" parse failure is recorded as a Diagnostic in the OCLHelper to verify that the parse did not fail because of an exception.
Fix committed to CVS HEAD (1.2 release). Thanks, Adolfo, for making the effort to submit JUnit tests. As it happens, in this case I was not able to use them because I found a mechanism that I prefer over checking for message text (which is subject to change). Comment on attachment 100781 [details]
contributed Test Cases
Marking the patch as obsolete because I did not end up using it.
Hi Christian, Don't worry, I'm just learning :). I certainly didn't like my test case. Using the message of the exception, is not very recommended (for example if the text of the problem changes, the test fails), but It was the first one which I could get to pass M6, and fail M7. I was very sure that you were changing it ;). One question more. AFAIU understand the test case and the new assetNoException method, the test case just fails if ClassCastException fails. The test itself is useful to show the problem before the patch. But it's not useful to detect further problems with the same case. I would have expected some a ssertion (assertException) of the expected problem, and if the exception is different from the expected one, then the test case fails. Maybe going through all the nested exception, and checking that every exception is not different from expected one, would be better.... I could provide an assertException method with the related behaviour, and apply it to all that cases which expects exceptions from the parser. The test cases should behave better (detecting problems) if any side-effect change is introduced. Cheers, Adolfo. Hi, Adolfo, You raise a good point. In this case, however, the check for ClassCastException in the test is actually redundant. Possibly it should be RuntimeException, but that would only actually be useful when (if) the parser starts to produce Diagnostics when parsing fails with exceptions. Where this test actually fails with the M7 code is in the assertion that there is a Diagnostic in the first place. For now, that will catch any future run-time exceptions. Closing after over 18 months in resolved state. |