@Test()
    public void testCreateDuplicateUser() throws Exception
    {
        // Setup test fixture.
        HybridUserProvider.PRIMARY_PROVIDER.setValue(TestUserProvider.NoUserProvider.class);
        HybridUserProvider.SECONDARY_PROVIDER.setValue(TestUserProvider.JaneUserProvider.class);
        HybridUserProvider.TERTIARY_PROVIDER.setValue(TestUserProvider.JohnUserProvider.class);
        final HybridUserProvider provider = new HybridUserProvider();

        // Execute system under test & Verify results.
        assertThrows(UserAlreadyExistsException.class, () -> provider.createUser("jane", "test", "Jane But Not Doe", "jane@example.com"));
    }
Verifies that an exception is thrown when a new user is being created, using a username that is not unique.
xmppserver/src/test/java/org/jivesoftware/openfire/user/HybridUserProviderTest.java