private void invokeTest(boolean indexMetadataIsComplete, int expectedBackendOperations) {
FullTextSessionBuilder fullTextSessionBuilder = createSearchFactory( indexMetadataIsComplete );
try {
LeakingOptimizer.reset();
LeakingLuceneBackend.reset();
FullTextSession session = fullTextSessionBuilder.openFullTextSession();
Assert.assertEquals( 0, LeakingOptimizer.getTotalOperations() );
Transaction tx = session.beginTransaction();
session.persist( new Document( "The Book", "many paper pages assembled together at one side", "[old language you don't understand]" ) );
tx.commit();