    @Test
    public void testGenerateDocumentationForNestedTypes() throws Exception {

        // given
        ObjectMapper mapper = createMapper();
        mockFieldComment(FirstLevel.class, "second", "2nd level");
        mockFieldComment(SecondLevel.class, "third", "3rd level");
        mockFieldComment(ThirdLevel.class, "fourth", "4th level");
        mockFieldComment(FourthLevel.class, "fifth", "5th level");
        mockFieldComment(FifthLevel.class, "last", "An integer");

        FieldDocumentationGenerator generator =
                new FieldDocumentationGenerator(mapper.writer(),
                        mapper.getDeserializationConfig(), javadocReader, constraintReader, typeMapping,
                        SnippetTranslationManager.getDefaultResolver(), null);
        Type type = FirstLevel.class;

        // when
        List<ExtendedFieldDescriptor> result = cast(generator
                .generateDocumentation(type, mapper.getTypeFactory()).values());

        // then
        assertThat(result.size(), is(5));
        assertThat(result.get(0),
                is(descriptor("second", "Object", "2nd level", "true")));
        assertThat(result.get(1),
                is(descriptor("second.third", "Array[Object]", "3rd level", "true")));
        assertThat(result.get(2),
                is(descriptor("second.third[].fourth", "Object", "4th level", "true")));
        assertThat(result.get(3),
                is(descriptor("second.third[].fourth.fifth", "Array[Object]", "5th level",
                        "true")));
        assertThat(result.get(4),
                is(descriptor("second.third[].fourth.fifth[].last", "Integer", "An integer",
                        "true")));
    }