@Test
    public void testUpdatedCaps() throws Exception
    {
        // Setup fixture.
        final JID entity = new JID( "john", "example.org", "mobile" );
        final EntityCapabilities capsA = new EntityCapabilities();
        capsA.setVerAttribute( "test-ver-a" );
        capsA.setHashAttribute( "test-hash-a" );
        capsA.addFeature( "test-feature-a" );
        capsA.addIdentity( "test-identity-a" );
        final EntityCapabilities capsB = new EntityCapabilities();
        capsB.setVerAttribute( "test-ver-b" );
        capsB.setHashAttribute( "test-hash-b" );
        capsB.addFeature( "test-feature-b" );
        capsB.addIdentity( "test-identity-b" );
        manager.addListener( allUsers );
        manager.addListener( entity, userSpecific );

        // Execute system under test.
        manager.registerCapabilities( entity, capsA );
        manager.registerCapabilities( entity, capsB );

        // Verify results.
        verify( allUsers, times(1) ).entityCapabilitiesChanged( entity, capsA, capsA.getFeatures(), Collections.emptySet(), capsA.getIdentities(), Collections.emptySet() );
        verify( allUsers, times(1) ).entityCapabilitiesChanged( entity, capsB, capsB.getFeatures(), capsA.getFeatures(), capsB.getIdentities(), capsA.getIdentities() );
        verify( userSpecific, times(1) ).entityCapabilitiesChanged( entity, capsA, capsA.getFeatures(), Collections.emptySet(), capsA.getIdentities(), Collections.emptySet() );
        verify( userSpecific, times(1) ).entityCapabilitiesChanged( entity, capsB, capsB.getFeatures(), capsA.getFeatures(), capsB.getIdentities(), capsA.getIdentities() );
    }
Asserts that registered listener get more events after an exising capability has been updated (verifies the
case of updated capabilities).
xmppserver/src/test/java/org/jivesoftware/openfire/entitycaps/EntityCapabilitiesListenerTest.java