private void assertIllegalName(String name) {
        try {
            new QueryProfile(name);
            fail("Should have failed");
        }
        catch (IllegalArgumentException e) {
            if (!name.isEmpty())
                assertEquals("Illegal name '" + name + "'",e.getMessage());
        }

        try {
            new QueryProfileType(name);
            fail("Should have failed");
        }
        catch (IllegalArgumentException e) {
            if (!name.isEmpty())
                assertEquals("Illegal name '" + name + "'",e.getMessage());
        }
    }
Checks that this is illegal both for profiles and types
container-search/src/test/java/com/yahoo/search/query/profile/types/test/NameTestCase.java