@Test public void testWithPolymorphismAsIsOrdering() throws IOException, URISyntaxException { //Given Path file = Paths.get(AsciidocConverterTest.class.getResource("/json/swagger_polymorphism.json").toURI()); Path outputDirectory = Paths.get("build/test/asciidoc/polymorphismAsIsOrdering"); FileUtils.deleteQuietly(outputDirectory.toFile()); //When Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder() .withPropertyOrdering(OrderBy.AS_IS) .build(); Swagger2MarkupConverter.from(file) .withConfig(config) .build() .toFolder(outputDirectory); //Then String[] files = outputDirectory.toFile().list(); assertThat(files).hasSize(4).containsAll(expectedFiles); Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/asciidoc/polymorphismAsIsOrdering").toURI()); DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testWithPolymorphismAsIsOrdering.html"); }
builder.withPropertyOrdering(OrderBy.CUSTOM); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM"); builder.withPropertyOrdering(Ordering.<String>natural()); assertThat(builder.config.getPropertyOrderBy()).isEqualTo(OrderBy.CUSTOM); assertThat(builder.config.getPropertyOrdering()).isEqualTo(Ordering.natural());