@Test
public void testConfigBuilder() {

    Swagger2MarkupConfigBuilder builder = new Swagger2MarkupConfigBuilder();
    try {
        builder.withTagOrdering(OrderBy.CUSTOM);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
    }
    builder.withTagOrdering(Ordering.<String>natural());
    Swagger2MarkupConfig config = builder.build();
    assertThat(config.getTagOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getTagOrdering()).isEqualTo(Ordering.natural());
    try {
        builder.withOperationOrdering(OrderBy.CUSTOM);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
    }
    builder.withOperationOrdering(Swagger2MarkupConfigBuilder.OPERATION_PATH_NATURAL_ORDERING);
    config = builder.build();
    assertThat(config.getOperationOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getOperationOrdering()).isEqualTo(Swagger2MarkupConfigBuilder.OPERATION_PATH_NATURAL_ORDERING);
    try {
        builder.withDefinitionOrdering(OrderBy.CUSTOM);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
    }
    builder.withDefinitionOrdering(Ordering.<String>natural());
    config = builder.build();
    assertThat(config.getDefinitionOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getDefinitionOrdering()).isEqualTo(Ordering.natural());
    try {
        builder.withParameterOrdering(OrderBy.CUSTOM);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
    }
    builder.withParameterOrdering(Swagger2MarkupConfigBuilder.PARAMETER_NAME_NATURAL_ORDERING);
    config = builder.build();
    assertThat(config.getParameterOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getParameterOrdering()).isEqualTo(Swagger2MarkupConfigBuilder.PARAMETER_NAME_NATURAL_ORDERING);
    try {
        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());
    config = builder.build();
    assertThat(config.getPropertyOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getPropertyOrdering()).isEqualTo(Ordering.natural());
    try {
        builder.withResponseOrdering(OrderBy.CUSTOM);
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage()).isEqualTo("You must provide a custom comparator if orderBy == OrderBy.CUSTOM");
    }
    builder.withResponseOrdering(Ordering.<String>natural());
    config = builder.build();
    assertThat(config.getResponseOrderBy()).isEqualTo(OrderBy.CUSTOM);
    assertThat(config.getResponseOrdering()).isEqualTo(Ordering.natural());
    
    assertThat(config.isListDelimiterEnabled()).isEqualTo(false);
    builder.withListDelimiter();
    config = builder.build();
    assertThat(config.getListDelimiter()).isEqualTo(Character.valueOf(','));
    assertThat(config.isListDelimiterEnabled()).isEqualTo(true);
    
}