@Test
    public void testRemoveTwoPublishedItemsSameIdentifier() throws Exception
    {
        // Setup test fixture.
        final CachingPubsubPersistenceProvider provider = new CachingPubsubPersistenceProvider();
        final LeafNode mockNode = Mockito.mock(LeafNode.class);
        Mockito.lenient().when(mockNode.getUniqueIdentifier()).thenReturn(new Node.UniqueIdentifier("mock-service-1", "mock-node-a"));
        final JID publisher = new JID("test-user-1", "example.org", null);
        final String identifier = UUID.randomUUID().toString();
        final PublishedItem itemA = new PublishedItem(mockNode, publisher, identifier, new Date());
        final PublishedItem itemB = new PublishedItem(mockNode, publisher, identifier, new Date());

        // Execute system under test.
        provider.removePublishedItem(itemA);
        provider.removePublishedItem(itemB);

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

        assertEquals(0, provider.itemsToAdd.size());
        assertEquals(2, provider.itemsToDelete.size());
    }
Asserts that an invocations {@link CachingPubsubPersistenceProvider#removePublishedItem(PublishedItem)} to
remove two items with the same identifier DOES NOT cause the provider to optimize: this is an erroneous invocation,
and the delegate provider should (possibly) thrown an exception (or silently ignore the duplicate).
xmppserver/src/test/java/org/jivesoftware/openfire/pubsub/CachingPubsubPersistenceProviderItemOperationsTest.java