[ 
https://issues.apache.org/jira/browse/JCR-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572872#action_12572872
 ] 

Jukka Zitting commented on JCR-1420:
------------------------------------

It's a good practice to use assertions for the expected failure points of the 
test case.

In this case, instead of allowing the InvalidItemStateException to be thrown as 
an error, we should catch it like this:

    // critical location regarding item state manager caching (see JCR-1197)
    try {
        grandChildNode.checkout();
    } catch (InvalidItemStateException e) {
        fail("JCR-1197: Node.restore() may throw InvalidItemStateException");
    }

Also, do we really need the loops? A test case should be as simple and 
straightforward as possible.

> Add test for Node.restore() may throw InvalidStateException
> -----------------------------------------------------------
>
>                 Key: JCR-1420
>                 URL: https://issues.apache.org/jira/browse/JCR-1420
>             Project: Jackrabbit
>          Issue Type: Test
>          Components: jackrabbit-core, test
>            Reporter: Alexander Klimetschek
>            Assignee: Jukka Zitting
>             Fix For: 1.5
>
>         Attachments: jackrabbit-core.unit-test-for-jcr-1197.patch
>
>
> Add a unit test for JCR-1399 in the 1.3 branch.
> A test for the original feature in the trunk/1.4 (JCR-1197) needs a separate 
> issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to