@Test
    public void testInvalidNullDefaultForPotentiallyNonNullableStruct() throws Exception {
        MessageSpec testMessageSpec = MessageGenerator.JSON_SERDE.readValue(String.join("", Arrays.asList(
            "{",
            "  \"type\": \"request\",",
            "  \"name\": \"FooBar\",",
            "  \"validVersions\": \"0-1\",",
            "  \"flexibleVersions\": \"none\",",
            "  \"fields\": [",
            "    { \"name\": \"struct1\", \"type\": \"MyStruct\", \"versions\": \"0+\", \"nullableVersions\": \"1+\", ",
            "      \"default\": \"null\", \"fields\": [",
            "        { \"name\": \"field1\", \"type\": \"string\", \"versions\": \"0+\" }",
            "      ]",
            "    }",
            "  ]",
            "}")), MessageSpec.class);

        assertStringContains("not all versions of this field are nullable",
            assertThrows(RuntimeException.class, () -> {
                new MessageDataGenerator("org.apache.kafka.common.message").generate(testMessageSpec);
            }).getMessage());
    }
Test attempting to create a field with an invalid name.  The name is
invalid because it starts with an underscore.
generator/src/test/java/org/apache/kafka/message/MessageDataGeneratorTest.java