### Question:
YamlDocGenerator { String generateForProperty(String fieldName, Map<String, Object> subSchema) { return "| " + "`" + fieldName + "`" + " | " + emptyIfNull(getType(fieldName, subSchema)) + " | " + emptyIfNull(getDescription(fieldName, subSchema)) + " |"; } YamlDocGenerator(Map<String, Object> schema); String generate(String schemaName); String generate(String reference, Map<String, Object> schema); void useKubernetesVersion(String k8sVersion); String getKubernetesSchemaMarkdown(); String getKubernetesSchemaMarkdownFile();  }### Answer:
@Test public void generateMarkdownForProperty() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("annotatedDouble")); assertThat( markdown, containsString(tableEntry("`annotatedDouble`", "number", "An annotated field"))); }
@Test public void whenSchemaHasUknownTypeAndNoReference_useAsSpecified() throws NoSuchFieldException { Map<String, Object> schema = ImmutableMap.of("anInt", of("type", "integer")); String markdown = new YamlDocGenerator(schema).generateForProperty("anInt", schema); assertThat(markdown, containsString(tableEntry("`anInt`", "integer", ""))); }
@Test public void whenPropertyTypeIsDateTime_doNotGenerateReference() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("dateTime")); assertThat(markdown, containsString(tableEntry("`dateTime`", "DateTime", ""))); }
@Test public void whenPropertyTypeIsMap_doNotGenerateReference() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("notes")); assertThat(markdown, containsString(tableEntry("`notes`", "Map", ""))); }
@Test public void whenPropertyTypeIsArrayOfStrings_generateType() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("myList")); assertThat(markdown, containsString(tableEntry("`myList`", "array of string", ""))); }
@Test public void whenPropertyTypeIsReferenceWithDescription_includeBoth() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("simpleUsage")); assertThat( markdown, containsString( tableEntry("`simpleUsage`", linkTo("Simple Object", "#simple-object"), "An example"))); }
@Test public void whenPropertyTypeIsReferenceArrayWithDescription_includeBoth() throws NoSuchFieldException { String markdown = generateForProperty(getClass().getDeclaredField("simpleArray")); assertThat( markdown, containsString( tableEntry( "`simpleArray`", "array of " + linkTo("Simple Object", "#simple-object"), "An array"))); }