@Test
    public void testDeleteAffiliationVoidsOlderCreateWithUpdate() 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.updateAffiliation(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)},
{@link CachingPubsubPersistenceProvider#updateAffiliation(Node, NodeAffiliate)} and
{@link CachingPubsubPersistenceProvider#removeAffiliation(Node, NodeAffiliate)} an affiliation is created, updated
and immediately removes again.

The caching provider can optimize these three 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