jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sorel <johann.so...@geomatys.fr>
Subject Tests bad practises ? or specified in JCR ?
Date Mon, 26 Oct 2009 13:55:15 GMT
Hello,

While implementing JCR using Jackrabbit jcr commun module I bumped in 
some error in tests.
Specialy those on node types like this one :

public void testEmptyNodeTypeTemplate() throws Exception {

        NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
        assertNull(ntt.getPrimaryItemName());

        assertNull(ntt.getDeclaredChildNodeDefinitions());
        assertNull(ntt.getDeclaredPropertyDefinitions());
    }

The problem here is we are often recommanded to Not return null when and 
empty array would be better.
The above test assume that we store a potentiel null array in the node 
type template and that it may be null.
For exemple I have implemented it with a Collection object and 
indirectly it never return null.

So rather than fixing my code to use an array and raise the risk of null 
pointer exceptions a bit everywhere. I am wondering it is not the test 
which is  making a dangerous assumption here.

Or is it said in JCR that the result must be null rather than an empty 
array ?

johann sorel

Mime
View raw message