@Test
    public void testUpdateTwoSubscriptions() 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 subscriber = new JID("test-user-1", "example.org", null);
        final String firstSubscriptionId = "test-subscription-id-" + StringUtils.randomString(7);
        final NodeSubscription firstSubscription = new NodeSubscription(mockNode, subscriber, subscriber, NodeSubscription.State.pending, firstSubscriptionId);
        final String secondSubscriptionId = "test-subscription-id-" + StringUtils.randomString(7);
        final NodeSubscription secondSubscription = new NodeSubscription(mockNode, subscriber, subscriber, NodeSubscription.State.unconfigured, secondSubscriptionId);

        // Execute system under test.
        provider.updateSubscription(mockNode, firstSubscription);
        provider.updateSubscription(mockNode, secondSubscription);

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

        final CachingPubsubPersistenceProvider.NodeOperation firstNodeOperation = pending.get(0);
        assertEquals(mockNode.getUniqueIdentifier(), firstNodeOperation.node.getUniqueIdentifier());
        assertEquals(CachingPubsubPersistenceProvider.NodeOperation.Action.UPDATE_SUBSCRIPTION, firstNodeOperation.action);
        assertEquals(firstSubscriptionId, firstNodeOperation.subscription.getID());
        assertNull(firstNodeOperation.affiliate);

        final CachingPubsubPersistenceProvider.NodeOperation secondNodeOperation = pending.get(1);
        assertEquals(mockNode.getUniqueIdentifier(), secondNodeOperation.node.getUniqueIdentifier());
        assertEquals(CachingPubsubPersistenceProvider.NodeOperation.Action.UPDATE_SUBSCRIPTION, secondNodeOperation.action);
        assertEquals(secondSubscriptionId, secondNodeOperation.subscription.getID());
        assertNull(secondNodeOperation.affiliate);

        assertEquals(0, provider.itemsPending.size());
        assertEquals(0, provider.itemsToAdd.size());
        assertEquals(0, provider.itemsToDelete.size());
    }
Executes a test that, through {@link CachingPubsubPersistenceProvider#updateSubscription(Node, NodeSubscription)}
attempts to update two different subscriptions (with a different ID, but same user and same node).

As these operations relate to two different subscriptions, the caching provider MUST NOT optimize these two
operations (where the 'net effect' of them is to have no operation).

Therefor, this test asserts that after both invocations, two operations are scheduled.
xmppserver/src/test/java/org/jivesoftware/openfire/pubsub/CachingPubsubPersistenceProviderSubscriptionOperationsTest.java