@Test()
    public void testCreateDuplicateUser() throws Exception
    {
        // Setup test fixture.
        JiveGlobals.setProperty(MappedUserProvider.PROPERTY_MAPPER_CLASSNAME, TestUserProviderMapper.class.getName());
        final MappedUserProvider provider = new MappedUserProvider();

        // 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/MappedUserProviderTest.java