/** * walk down the set of statements (represented as an array), recursing with and without each * statement being present. The mask bits record those statements that are in the model. At the * bottom of the recursion (n == 0), check that R can be reified exactly when all four quad * components are present; the other statements don't matter. */ private void testCombinations(Model m, Resource R, int mask, Object[][] statements, int n) { if (n == 0) { try { // System.err.println( "| hello. mask = " + mask ); ReifiedStatement rs = (ReifiedStatement) R.as(ReifiedStatement.class); // System.err.println( "+ we constructed " + rs ); assertTrue( "should not reify: not all components present [" + mask + "]: " + rs, (mask & 15) == 15); // System.err.println( "+ and we passed the assertion." ); } catch (DoesNotReifyException e) { // System.err.println( "+ we exploded" ); assertFalse("should reify: all components present", mask == 15); } } else { int i = n - 1; Statement s = (Statement) statements[i][0]; int bits = ((Integer) statements[i][1]).intValue(); testCombinations(m, R, mask, statements, i); m.add(s); testCombinations(m, R, mask + bits, statements, i); m.remove(s); } }