diff --git a/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraintTest.java b/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraintTest.java index 6453ceabef1..70d830c3efb 100644 --- a/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraintTest.java +++ b/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraintTest.java @@ -103,16 +103,16 @@ public void testCreateValueConstraints2() throws RepositoryException { } public void testCreateInvalidValueConstraints() throws RepositoryException { - try { - String[] invalidQDefs = getInvalidQDefinitions(); - for (int i = 0; i < invalidQDefs.length; i++) { - createValueConstraint(invalidQDefs[i]); + String[] invalidQDefs = getInvalidQDefinitions(); + for (String invalidQDef : invalidQDefs) { + try { + createValueConstraint(invalidQDef); fail("Creating an invalid definition should throw InvalidConstraintException"); + } catch (InvalidConstraintException e) { + //ok + } catch (IllegalArgumentException e) { + //ok } - } catch (InvalidConstraintException e) { - //ok - } catch (IllegalArgumentException e) { - // ok } }