@Test
    void testFieldNames() {
        assertLegalFieldName("aB");
        try {
            QueryProfile profile = new QueryProfile("test");
            profile.set("a.", "anyValue", (QueryProfileRegistry) null);
            fail("Should have failed");
        } catch (IllegalArgumentException e) {
            assertEquals("'a.' is not a legal compound name. Names can not end with a dot.", e.getMessage());
        }
        assertLegalFieldName("_a_b");
        assertLegalFieldName("a_b");
        assertLegalFieldName("a/b");
        assertLegalFieldName("/a/b");
        assertLegalFieldName("/a/b/");
        assertIllegalFieldName("aBc.dooEee.ce_d.-some-other.moreHere",
                "Could not set 'aBc.dooEee.ce_d.-some-other.moreHere' to 'anyValue'",
                "Illegal name '-some-other'");
    }
tests creating invalid names

@author bratseth
container-search/src/test/java/com/yahoo/search/query/profile/types/test/NameTestCase.java