@Test
    public void testUsernames() {
        new JID("john@mycomapny.com");
        new JID("john_paul@mycomapny.com");
        new JID("john-paul@mycomapny.com");
        boolean failed = false;
        try {
            new JID("john paul@mycomapny.com");
        } catch (Exception e) {
            failed = true;
        }
        assertTrue(failed, "A username with spaces was accepted");
    }
Test cases for the JID class.

@author Gaston Dombiak
xmppserver/src/test/java/org/jivesoftware/util/JIDTest.java