diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b2244db --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: java +jdk: + - openjdk11 + diff --git a/build.gradle b/build.gradle index 3fb8022..bdae363 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { - id "org.sonarqube" version "2.6.1" - id "io.codearte.nexus-staging" version "0.11.0" - id "com.github.spotbugs" version "2.0.0" + id "org.sonarqube" version "2.8" + id "io.codearte.nexus-staging" version "0.21.1" + id "com.github.spotbugs" version "2.0.1" id "org.xbib.gradle.plugin.asciidoctor" version "1.5.6.0.1" } @@ -24,7 +24,11 @@ subprojects { } dependencies { - testCompile "junit:junit:${project.property('junit.version')}" + testCompile "org.junit.jupiter:junit-jupiter-api:${project.property('junit.version')}" + testCompile "org.junit.jupiter:junit-jupiter-params:${project.property('junit.version')}" + testCompile "org.junit.jupiter:junit-jupiter-engine:${project.property('junit.version')}" + testCompile "org.junit.vintage:junit-vintage-engine:${project.property('junit.version')}" + testCompile "junit:junit:${project.property('junit4.version')}" asciidoclet "org.asciidoctor:asciidoclet:${project.property('asciidoclet.version')}" } @@ -44,9 +48,19 @@ subprojects { } test { + useJUnitPlatform() + failFast = false testLogging { - showStandardStreams = false - exceptionFormat = 'full' + events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED' + } + afterSuite { desc, result -> + if (!desc.parent) { + println "\nTest result: ${result.resultType}" + println "Test summary: ${result.testCount} tests, " + + "${result.successfulTestCount} succeeded, " + + "${result.failedTestCount} failed, " + + "${result.skippedTestCount} skipped" + } } } @@ -112,7 +126,6 @@ subprojects { } } - ext { projectDescription = 'Content processing library for Java' scmUrl = 'https://github.com/xbib/content' @@ -175,5 +188,4 @@ subprojects { nexusStaging { packageGroup = "org.xbib" } - } diff --git a/content-core/src/main/java/org/xbib/content/XContentBuilder.java b/content-core/src/main/java/org/xbib/content/XContentBuilder.java index 42a360a..6124b97 100644 --- a/content-core/src/main/java/org/xbib/content/XContentBuilder.java +++ b/content-core/src/main/java/org/xbib/content/XContentBuilder.java @@ -879,13 +879,17 @@ public final class XContentBuilder implements ToXContent, Flushable, Closeable { } else if (value instanceof Iterable) { generator.writeStartArray(); for (Object v : (Iterable) value) { - writeValue(v); + if (v != value) { + writeValue(v); + } } generator.writeEndArray(); } else if (value instanceof Object[]) { generator.writeStartArray(); for (Object v : (Object[]) value) { - writeValue(v); + if (v != value) { + writeValue(v); + } } generator.writeEndArray(); } else if (type == byte[].class) { diff --git a/content-json/build.gradle b/content-json/build.gradle index 43cc0ff..7af65c1 100644 --- a/content-json/build.gradle +++ b/content-json/build.gradle @@ -1,10 +1,10 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}" - testCompile("junit:junit:${project.property('junit.version')}") { + testCompile("junit:junit:${project.property('junit4.version')}") { exclude group: 'org.hamcrest' } testCompile("org.mockito:mockito-core:${project.property('mockito.version')}") { exclude group: 'org.hamcrest' } - testCompile "org.hamcrest:hamcrest-all:${project.property('hamcrest.version')}" + testCompile "org.hamcrest:hamcrest-library:${project.property('hamcrest.version')}" } diff --git a/content-resource/build.gradle b/content-resource/build.gradle index 7f83def..3a626c6 100644 --- a/content-resource/build.gradle +++ b/content-resource/build.gradle @@ -1,4 +1,3 @@ - dependencies { compile "org.xbib:net-url:${project.property('xbib-net.version')}" testCompile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}" diff --git a/gradle.properties b/gradle.properties index bcf23fa..ef15143 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,17 @@ group = org.xbib name = content -version = 2.0.2 +version = 2.0.4 -xbib-net.version = 2.0.1 -jackson.version = 2.9.9 -jackson-databind.version = 2.9.9.2 -woodstox.version = 6.0.1 +xbib-net.version = 2.0.3 +jackson.version = 2.9.10 +jackson-databind.version = 2.9.10.1 +woodstox.version = 6.0.2 # test -junit.version = 4.12 -hamcrest.version = 1.3 -mockito.version = 2.25.1 +junit.version = 5.5.2 +junit4.version = 4.12 +hamcrest.version = 2.1 +mockito.version = 3.1.0 # doc -asciidoclet.version = 1.5.4 - -org.gradle.warning.mode = all +asciidoclet.version = 1.5.6