@Test
    public void testDeleteAffiliationAfterCreateAffiliation() throws Exception
    {
        // Setup test fixture.
        final CachingPubsubPersistenceProvider provider = new CachingPubsubPersistenceProvider();
        final Node mockNode = Mockito.mock(Node.class);
        Mockito.lenient().when(mockNode.getUniqueIdentifier()).thenReturn(new Node.UniqueIdentifier("mock-service-1", "mock-node-a"));
        final JID affiliateAddress = new JID("test-user-1", "example.org", null);
        final NodeAffiliate affiliate = new NodeAffiliate(mockNode, affiliateAddress);
        final NodeAffiliate.Affiliation affiliation = NodeAffiliate.Affiliation.publisher;
        affiliate.setAffiliation(affiliation);

        // Execute system under test.
        provider.createAffiliation(mockNode, affiliate);
        provider.removeAffiliation(mockNode, affiliate);

        // Verify results.
        final List<CachingPubsubPersistenceProvider.NodeOperation> pending = provider.nodesToProcess.computeIfAbsent(mockNode.getUniqueIdentifier(), id -> new ArrayList<>());
        assertEquals(0, pending.size());

        assertEquals(0, provider.itemsPending.size());
        assertEquals(0, provider.itemsToAdd.size());
        assertEquals(0, provider.itemsToDelete.size());
    }
Executes a test that, through {@link CachingPubsubPersistenceProvider#createAffiliation(Node, NodeAffiliate)}
and {@link CachingPubsubPersistenceProvider#removeAffiliation(Node, NodeAffiliate)} creates and immediately removes
an affiliation.

The caching provider can optimize these two operations, where the 'net effect' of them is to have no operation.

Therefor, this test asserts that after each invocation, no operation is scheduled.
xmppserver/src/test/java/org/jivesoftware/openfire/pubsub/CachingPubsubPersistenceProviderAffiliationOperationsTest.java