class DefinitionDocumentNameResolver extends DocumentResolver {

    public String apply(String definitionName) {
        if (config.isSeparatedDefinitionsEnabled())
            return new File(config.getSeparatedDefinitionsFolder(), markupDocBuilder.addFileExtension(normalizeName(definitionName))).getPath();
        else
            return markupDocBuilder.addFileExtension(config.getDefinitionsDocument());
    }

}

class DefinitionDocumentNameResolverTest {

    @Test
    public void testWithInterDocumentCrossReferencesAndNoOutputPath() {

        Swagger2MarkupConfig config = (Swagger2MarkupConfig) new Swagger2MarkupConfigBuilder()
                .withInterDocumentCrossReferences()
                .build();
        Swagger2MarkupConverter.SwaggerContext context = createContext(config);

        assertThat(new DefinitionDocumentNameResolver(context).apply("DefinitionName"))
                .isEqualTo("definitions.adoc");
    }

}