@Test
    public void testThatCounterIncreasesExactlyOnCommitFailure() throws Exception {
        MockCurator curator = new MockCurator();
        CachingCurator database = new CachingCurator(curator, Path.fromString("/"), true);

        assertEquals(0L, (long)curator.counter("/changeCounter").get().get().postValue());

        try {
            commitCreate("/1/2", database); // fail as parent does not exist
            fail("Expected exception");
        }
        catch (Exception expected) {
            // expected because the parent does not exist
        }
        // Counter increased once, since prepare failed.
        assertEquals(1L, (long)curator.counter("/changeCounter").get().get().postValue());

        try {
            commitFailing(database); // fail during commit
            fail("Expected exception");
        }
        catch (Exception expected) { }
        // Counter increased, even though commit failed.
        assertEquals(3L, (long)curator.counter("/changeCounter").get().get().postValue());
    }
Tests the curator db directly.
This verifies the details of the current implementation of the database, not just its API;
breaking this does not necessarily mean that a change is wrong.

@author bratseth
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/persistence/CachingCuratorTest.java