@Test
    public void testDomain() {
        new JID("mycomapny.com");
        new JID("wfink-adm");

        boolean failed = false;
        try {
            new JID("wfink adm");
        } catch (Exception e) {
            failed = true;
        }
        assertTrue(failed, "A domain with spaces was accepted");

        failed = false;
        try {
            new JID("wfink_adm");
        } catch (Exception e) {
            failed = true;
        }
        assertTrue(failed, "A domain with _ was accepted");
    }
Test cases for the JID class.

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