private void assertIllegalFieldName(String name, String expectedHighError, String expectedLowError) {
        try {
            QueryProfile profile=new QueryProfile("test");
            profile.set(name, "anyValue", (QueryProfileRegistry)null);
            fail("Should have failed");
        }
        catch (IllegalArgumentException e) {
            assertEquals(expectedHighError + ": " + expectedLowError, Exceptions.toMessageString(e));
        }

        try {
            new FieldDescription(name, FieldType.stringType);
            fail("Should have failed");
        }
        catch (IllegalArgumentException e) {
            assertEquals(expectedLowError, 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