diff --git a/build.gradle b/build.gradle index fc61e3c..6b8c43f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,102 +1,33 @@ plugins { - id "org.sonarqube" version '2.2' - id "org.xbib.gradle.plugin.asciidoctor" version "1.5.4.1.0" + id "de.marcphilipp.nexus-publish" version "0.4.0" + id "io.codearte.nexus-staging" version "0.21.1" } -printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGroovy: %s\nGradle: %s\n" + - "Build: group: ${project.group} name: ${project.name} version: ${project.version}\n", - InetAddress.getLocalHost(), - System.getProperty("os.name"), - System.getProperty("os.arch"), - System.getProperty("os.version"), - System.getProperty("java.version"), - System.getProperty("java.vm.version"), - System.getProperty("java.vm.vendor"), - System.getProperty("java.vm.name"), - GroovySystem.getVersion(), - gradle.gradleVersion - - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'signing' -apply plugin: 'findbugs' -apply plugin: 'pmd' -apply plugin: 'checkstyle' -apply plugin: 'jacoco' -apply plugin: 'org.xbib.gradle.plugin.asciidoctor' - -repositories { - mavenCentral() +wrapper { + gradleVersion = "${project.property('gradle.wrapper.version')}" + distributionType = Wrapper.DistributionType.ALL } -configurations { - asciidoclet - wagon +ext { + user = 'xbib' + name = 'standardnumber' + description = 'Standardnumber processing for Java' + inceptionYear = '2016' + url = 'https://github.com/' + user + '/' + name + scmUrl = 'https://github.com/' + user + '/' + name + scmConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git' + scmDeveloperConnection = 'scm:git:ssh://git@github.com:' + user + '/' + name + '.git' + issueManagementSystem = 'Github' + issueManagementUrl = ext.scmUrl + '/issues' + licenseName = 'The Apache License, Version 2.0' + licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } -dependencies { - testCompile 'junit:junit:4.12' - asciidoclet 'org.asciidoctor:asciidoclet:1.5.4' - wagon 'org.apache.maven.wagon:wagon-ssh-external:2.10' -} +apply plugin: 'java-library' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +apply from: rootProject.file('gradle/ide/idea.gradle') +apply from: rootProject.file('gradle/compile/java.gradle') +apply from: rootProject.file('gradle/test/junit5.gradle') +apply from: rootProject.file('gradle/publishing/publication.gradle') +apply from: rootProject.file('gradle/publishing/sonatype.gradle') -[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-profile" << "compact2" -} - -test { - testLogging { - showStandardStreams = false - exceptionFormat = 'full' - } - reports.html.destination = file("${projectDir}/docs/test") -} - -asciidoctor { - backends 'html5' - outputDir = file("${projectDir}/docs") - separateOutputDirs = false - attributes 'source-highlighter': 'coderay', - toc : '', - idprefix : '', - idseparator : '-', - stylesheet: "${projectDir}/src/docs/asciidoc/css/foundation.css" -} - -javadoc { - options.docletpath = configurations.asciidoclet.files.asType(List) - options.doclet = 'org.asciidoctor.Asciidoclet' - options.overview = "src/docs/asciidoclet/overview.adoc" - options.addStringOption "-base-dir", "${projectDir}" - options.addStringOption "-attribute", - "name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}" - options.destinationDirectory(file("${projectDir}/docs/javadoc")) - configure(options) { - noTimestamp = true - } -} - -task sourcesJar(type: Jar, dependsOn: classes) { - classifier 'sources' - from sourceSets.main.allSource -} -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier 'javadoc' -} -artifacts { - archives sourcesJar, javadocJar -} -if (project.hasProperty('signing.keyId')) { - signing { - sign configurations.archives - } -} - -apply from: 'gradle/ext.gradle' -apply from: 'gradle/publish.gradle' -apply from: 'gradle/sonarqube.gradle' diff --git a/gradle.properties b/gradle.properties index aa0f939..bc64163 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,6 @@ group = org.xbib name = standardnumber -version = 1.0.1 +version = 1.1.0 + +gradle.wrapper.version = 6.4.1 + diff --git a/gradle/compile/java.gradle b/gradle/compile/java.gradle new file mode 100644 index 0000000..9c8798d --- /dev/null +++ b/gradle/compile/java.gradle @@ -0,0 +1,43 @@ + +apply plugin: 'java-library' + +java { + modularity.inferModulePath.set(true) +} + +compileJava { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +compileTestJava { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +jar { + manifest { + attributes('Implementation-Version': project.version) + } +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier 'javadoc' +} + +artifacts { + archives sourcesJar, javadocJar +} + +tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:all' +} + +javadoc { + options.addStringOption('Xdoclint:none', '-quiet') +} diff --git a/gradle/documentation/asciidoc.gradle b/gradle/documentation/asciidoc.gradle new file mode 100644 index 0000000..87ba22e --- /dev/null +++ b/gradle/documentation/asciidoc.gradle @@ -0,0 +1,55 @@ +apply plugin: 'org.xbib.gradle.plugin.asciidoctor' + +configurations { + asciidoclet +} + +dependencies { + asciidoclet "org.asciidoctor:asciidoclet:${project.property('asciidoclet.version')}" +} + + +asciidoctor { + backends 'html5' + outputDir = file("${rootProject.projectDir}/docs") + separateOutputDirs = false + attributes 'source-highlighter': 'coderay', + idprefix: '', + idseparator: '-', + toc: 'left', + doctype: 'book', + icons: 'font', + encoding: 'utf-8', + sectlink: true, + sectanchors: true, + linkattrs: true, + imagesdir: 'img', + stylesheet: "${projectDir}/src/docs/asciidoc/css/foundation.css" +} + + +/*javadoc { +options.docletpath = configurations.asciidoclet.files.asType(List) +options.doclet = 'org.asciidoctor.Asciidoclet' +//options.overview = "src/docs/asciidoclet/overview.adoc" +options.addStringOption "-base-dir", "${projectDir}" +options.addStringOption "-attribute", + "name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}" +configure(options) { + noTimestamp = true +} +}*/ + + +/*javadoc { + options.docletpath = configurations.asciidoclet.files.asType(List) + options.doclet = 'org.asciidoctor.Asciidoclet' + options.overview = "${rootProject.projectDir}/src/docs/asciidoclet/overview.adoc" + options.addStringOption "-base-dir", "${projectDir}" + options.addStringOption "-attribute", + "name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}" + options.destinationDirectory(file("${projectDir}/docs/javadoc")) + configure(options) { + noTimestamp = true + } +}*/ diff --git a/gradle/ext.gradle b/gradle/ext.gradle deleted file mode 100644 index 0d41a02..0000000 --- a/gradle/ext.gradle +++ /dev/null @@ -1,8 +0,0 @@ -ext { - user = 'xbib' - projectName = 'standardnumber' - projectDescription = 'Standardnumber processing for Java' - scmUrl = 'https://github.com/xbib/standardnumber' - scmConnection = 'scm:git:git://github.com/xbib/standardnumber.git' - scmDeveloperConnection = 'scm:git:git://github.com/xbib/standardnumber.git' -} diff --git a/gradle/ide/idea.gradle b/gradle/ide/idea.gradle new file mode 100644 index 0000000..64e2167 --- /dev/null +++ b/gradle/ide/idea.gradle @@ -0,0 +1,13 @@ +apply plugin: 'idea' + +idea { + module { + outputDir file('build/classes/java/main') + testOutputDir file('build/classes/java/test') + } +} + +if (project.convention.findPlugin(JavaPluginConvention)) { + //sourceSets.main.output.classesDirs = file("build/classes/java/main") + //sourceSets.test.output.classesDirs = file("build/classes/java/test") +} diff --git a/gradle/publish.gradle b/gradle/publish.gradle deleted file mode 100644 index caf0531..0000000 --- a/gradle/publish.gradle +++ /dev/null @@ -1,66 +0,0 @@ - -task xbibUpload(type: Upload, dependsOn: build) { - configuration = configurations.archives - uploadDescriptor = true - repositories { - if (project.hasProperty('xbibUsername')) { - mavenDeployer { - configuration = configurations.wagon - repository(url: uri('scpexe://xbib.org/repository')) { - authentication(userName: xbibUsername, privateKey: xbibPrivateKey) - } - } - } - } -} - -task sonatypeUpload(type: Upload, dependsOn: build) { - configuration = configurations.archives - uploadDescriptor = true - repositories { - if (project.hasProperty('ossrhUsername')) { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - repository(url: uri(ossrhReleaseUrl)) { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - snapshotRepository(url: uri(ossrhSnapshotUrl)) { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - pom.project { - groupId project.group - artifactId project.name - version project.version - name project.name - description projectDescription - packaging 'jar' - inceptionYear '2016' - url scmUrl - organization { - name 'xbib' - url 'http://xbib.org' - } - developers { - developer { - id user - name 'Jörg Prante' - email 'joergprante@gmail.com' - url 'https://github.com/jprante' - } - } - scm { - url scmUrl - connection scmConnection - developerConnection scmDeveloperConnection - } - licenses { - license { - name 'The Apache License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - } - } - } - } -} diff --git a/gradle/publishing/publication.gradle b/gradle/publishing/publication.gradle new file mode 100644 index 0000000..c35fcb9 --- /dev/null +++ b/gradle/publishing/publication.gradle @@ -0,0 +1,64 @@ + +apply plugin: "de.marcphilipp.nexus-publish" + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + pom { + name = project.name + description = rootProject.ext.description + url = rootProject.ext.url + inceptionYear = rootProject.ext.inceptionYear + packaging = 'jar' + organization { + name = 'xbib' + url = 'https://xbib.org' + } + developers { + developer { + id = 'jprante' + name = 'Jörg Prante' + email = 'joergprante@gmail.com' + url = 'https://github.com/jprante' + } + } + scm { + url = rootProject.ext.scmUrl + connection = rootProject.ext.scmConnection + developerConnection = rootProject.ext.scmDeveloperConnection + } + issueManagement { + system = rootProject.ext.issueManagementSystem + url = rootProject.ext.issueManagementUrl + } + licenses { + license { + name = rootProject.ext.licenseName + url = rootProject.ext.licenseUrl + distribution = 'repo' + } + } + } + } + } +} + +if (project.hasProperty("signing.keyId")) { + apply plugin: 'signing' + signing { + sign publishing.publications.mavenJava + } +} + +nexusPublishing { + repositories { + sonatype { + username = project.property('ossrhUsername') + password = project.property('ossrhPassword') + packageGroup = "org.xbib" + } + } +} diff --git a/gradle/publishing/sonatype.gradle b/gradle/publishing/sonatype.gradle new file mode 100644 index 0000000..e1813f3 --- /dev/null +++ b/gradle/publishing/sonatype.gradle @@ -0,0 +1,11 @@ + +if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) { + + apply plugin: 'io.codearte.nexus-staging' + + nexusStaging { + username = project.property('ossrhUsername') + password = project.property('ossrhPassword') + packageGroup = "org.xbib" + } +} diff --git a/gradle/sonarqube.gradle b/gradle/sonarqube.gradle deleted file mode 100644 index 6d4c3fa..0000000 --- a/gradle/sonarqube.gradle +++ /dev/null @@ -1,41 +0,0 @@ -tasks.withType(FindBugs) { - ignoreFailures = true - reports { - xml.enabled = true - html.enabled = false - } -} -tasks.withType(Pmd) { - ignoreFailures = true - reports { - xml.enabled = true - html.enabled = true - } -} -tasks.withType(Checkstyle) { - ignoreFailures = true - reports { - xml.enabled = true - html.enabled = true - } -} - -jacocoTestReport { - reports { - xml.enabled true - csv.enabled false - xml.destination "${buildDir}/reports/jacoco-xml" - html.destination "${buildDir}/reports/jacoco-html" - } -} - -sonarqube { - properties { - property "sonar.projectName", "${project.group} ${project.name}" - property "sonar.sourceEncoding", "UTF-8" - property "sonar.tests", "src/test/java" - property "sonar.scm.provider", "git" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.junit.reportsPath", "build/test-results/test/" - } -} diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle new file mode 100644 index 0000000..cfef972 --- /dev/null +++ b/gradle/test/junit5.gradle @@ -0,0 +1,27 @@ + +def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.6.2' +def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2' + +dependencies { + testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" + testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" + testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" +} + +test { + useJUnitPlatform() + failFast = true + testLogging { + 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" + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 9143e9d..62d4c05 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5d83f48..21e622d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Jan 30 21:28:38 CET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/gradlew b/gradlew index 4453cce..fbd7c51 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,16 +44,16 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -66,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -109,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -138,35 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index e95643d..a9f778a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%* set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..acb5895 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.xbib.standardnumber { + exports org.xbib.standardnumber; + exports org.xbib.standardnumber.checksum; + exports org.xbib.standardnumber.checksum.iso7064; + requires java.xml; // for reading ISBN config file +} diff --git a/src/main/java/org/xbib/standardnumber/StandardNumberSpi.java b/src/main/java/org/xbib/standardnumber/StandardNumberSpi.java index f7f1cf2..e4f6eec 100644 --- a/src/main/java/org/xbib/standardnumber/StandardNumberSpi.java +++ b/src/main/java/org/xbib/standardnumber/StandardNumberSpi.java @@ -6,7 +6,6 @@ import java.util.Locale; */ abstract class StandardNumberSpi { - @SuppressWarnings("unchecked") public static StandardNumber getInstance(String type) throws NoSuchStandardNumberException { return getInstance(StandardNumberSpi.class.getPackage(), StandardNumberSpi.class.getClassLoader(), type); } @@ -17,7 +16,7 @@ abstract class StandardNumberSpi { String className = thePackage.getName() + "." + type.toUpperCase(Locale.ROOT); try { Class clazz = (Class) classLoader.loadClass(className); - return clazz.newInstance(); + return clazz.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new NoSuchStandardNumberException(type); } diff --git a/src/main/resources/org/xbib/standardnumber/RangeMessage.xml b/src/main/resources/org/xbib/standardnumber/RangeMessage.xml index def73d8..7bc02ba 100644 --- a/src/main/resources/org/xbib/standardnumber/RangeMessage.xml +++ b/src/main/resources/org/xbib/standardnumber/RangeMessage.xml @@ -17,8 +17,8 @@ ]> International ISBN Agency - b4317af0-a610-449a-9802-b2769f0c7db9 - Thu, 31 Mar 2016 13:54:44 CEST + 0bd46fe8-fe65-4ede-a20f-8741c3163616 + Mon, 8 Jun 2020 10:00:16 CEST 978 @@ -33,7 +33,11 @@ 3 - 6500000-6999999 + 6500000-6599999 + 2 + + + 6600000-6999999 0 @@ -71,7 +75,15 @@ 2 - 1300000-9999999 + 1300000-7999999 + 0 + + + 8000000-8999999 + 1 + + + 9000000-9999999 0 @@ -87,7 +99,51 @@ 2 - 2000000-6999999 + 2000000-2279999 + 3 + + + 2280000-2289999 + 4 + + + 2290000-3689999 + 3 + + + 3690000-3699999 + 4 + + + 3700000-6389999 + 3 + + + 6390000-6397999 + 4 + + + 6398000-6399999 + 7 + + + 6400000-6479999 + 3 + + + 6480000-6489999 + 7 + + + 6490000-6549999 + 3 + + + 6550000-6559999 + 4 + + + 6560000-6999999 3 @@ -113,27 +169,147 @@ English language - 0000000-0999999 - 2 - - - 1000000-3999999 + 0000000-0099999 3 - 4000000-5499999 + 0100000-0299999 + 2 + + + 0300000-0349999 + 3 + + + 0350000-0399999 4 - 5500000-8697999 + 0400000-0699999 + 2 + + + 0700000-0999999 + 4 + + + 1000000-3979999 + 3 + + + 3980000-5499999 + 4 + + + 5500000-6499999 5 - 8698000-9989999 + 6500000-6799999 + 4 + + + 6800000-6859999 + 5 + + + 6860000-7139999 + 4 + + + 7140000-7169999 + 3 + + + 7170000-7319999 + 4 + + + 7320000-7399999 + 7 + + + 7400000-7749999 + 5 + + + 7750000-7753999 + 7 + + + 7754000-7763999 + 5 + + + 7764000-7764999 + 7 + + + 7765000-7769999 + 5 + + + 7770000-7776999 + 7 + + + 7777000-7899999 + 5 + + + 7900000-7999999 + 4 + + + 8000000-8004999 + 5 + + + 8005000-8049999 + 5 + + + 8050000-8379999 + 5 + + + 8380000-8384999 + 7 + + + 8385000-8671999 + 5 + + + 8672000-8675999 + 4 + + + 8676000-8697999 + 5 + + + 8698000-9159999 6 - 9990000-9999999 + 9160000-9165059 + 7 + + + 9165060-9729999 + 6 + + + 9730000-9877999 + 4 + + + 9878000-9989899 + 6 + + + 9989900-9999999 7 @@ -155,7 +331,27 @@ 5 - 4000000-6999999 + 4000000-4899999 + 3 + + + 4900000-4949999 + 6 + + + 4950000-4959999 + 3 + + + 4960000-4966999 + 4 + + + 4967000-4969999 + 5 + + + 4970000-6999999 3 @@ -167,7 +363,23 @@ 5 - 9000000-9499999 + 9000000-9197999 + 6 + + + 9198000-9198099 + 5 + + + 9198100-9199429 + 6 + + + 9199430-9199689 + 7 + + + 9199690-9499999 6 @@ -225,15 +437,11 @@ 5 - 9700000-9899999 + 9700000-9849999 7 - 9900000-9949999 - 5 - - - 9950000-9999999 + 9850000-9999999 5 @@ -309,7 +517,15 @@ 4 - 4500000-6999999 + 4500000-6039999 + 3 + + + 6040000-6049999 + 7 + + + 6050000-6999999 3 @@ -375,7 +591,19 @@ 4 - 9000000-9999999 + 9000000-9867999 + 5 + + + 9868000-9929999 + 4 + + + 9930000-9959999 + 3 + + + 9960000-9999999 5 @@ -411,23 +639,11 @@ Indonesia - 0000000-0799999 + 0000000-0699999 2 - 0800000-0899999 - 4 - - - 0900000-1099999 - 4 - - - 1100000-1199999 - 4 - - - 1200000-1399999 + 0700000-1399999 4 @@ -439,27 +655,27 @@ 4 - 1700000-1799999 + 1700000-1999999 5 - 1800000-1899999 - 5 - - - 1900000-1999999 - 5 - - - 2000000-6199999 + 2000000-4999999 3 - 6200000-6749999 + 5000000-5399999 + 5 + + + 5400000-5999999 4 - 6750000-6999999 + 6000000-6199999 + 5 + + + 6200000-6999999 4 @@ -467,11 +683,7 @@ 5 - 7500000-7999999 - 4 - - - 8000000-9499999 + 7500000-9499999 4 @@ -533,11 +745,7 @@ Turkey - 0000000-0099999 - 0 - - - 0100000-0299999 + 0000000-0299999 2 @@ -549,7 +757,15 @@ 2 - 1000000-3999999 + 1000000-1999999 + 3 + + + 2000000-2399999 + 4 + + + 2400000-3999999 3 @@ -557,7 +773,15 @@ 4 - 6000000-8999999 + 6000000-7499999 + 5 + + + 7500000-7999999 + 4 + + + 8000000-8999999 5 @@ -571,11 +795,11 @@ Romania - 0000000-0999999 - 1 + 0000000-0899999 + 3 - 1000000-4999999 + 0900000-4999999 2 @@ -591,9 +815,13 @@ 3 - 9200000-9749999 + 9200000-9649999 5 + + 9650000-9749999 + 4 + 9750000-9999999 3 @@ -624,7 +852,7 @@ 978-608 - Macedonia + North Macedonia 0000000-0999999 @@ -900,6 +1128,204 @@ + + 978-622 + Iran + + + 0000000-0899999 + 2 + + + 0900000-1999999 + 0 + + + 2000000-2999999 + 3 + + + 3000000-5999999 + 0 + + + 6000000-7499999 + 4 + + + 7500000-9499999 + 0 + + + 9500000-9999999 + 5 + + + + + 978-623 + Indonesia + + + 0000000-0999999 + 2 + + + 1000000-1999999 + 0 + + + 2000000-2999999 + 3 + + + 3000000-6499999 + 0 + + + 6500000-7999999 + 4 + + + 8000000-8999999 + 0 + + + 9000000-9999999 + 5 + + + + + 978-624 + Sri Lanka + + + 0000000-0499999 + 2 + + + 0500000-1999999 + 0 + + + 2000000-2499999 + 3 + + + 2500000-4999999 + 0 + + + 5000000-5999999 + 4 + + + 6000000-9499999 + 0 + + + 9500000-9999999 + 5 + + + + + 978-625 + Turkey + + + 0000000-0099999 + 2 + + + 0100000-3999999 + 0 + + + 4000000-4499999 + 3 + + + 4500000-6999999 + 0 + + + 7000000-7999999 + 4 + + + 8000000-9999999 + 0 + + + + + 978-65 + Brazil + + + 0000000-0199999 + 2 + + + 0200000-2499999 + 0 + + + 2500000-2999999 + 3 + + + 3000000-3029999 + 3 + + + 3030000-4999999 + 0 + + + 5000000-5129999 + 4 + + + 5130000-5499999 + 0 + + + 5500000-5999999 + 4 + + + 6000000-7999999 + 0 + + + 8000000-8182499 + 5 + + + 8182500-8599999 + 0 + + + 8600000-8999999 + 5 + + + 9000000-9024499 + 6 + + + 9024500-9899999 + 0 + + + 9900000-9999999 + 6 + + + 978-7 China, People's Republic @@ -947,9 +1373,13 @@ 5 - 9000000-9999999 + 9000000-9989999 6 + + 9990000-9999999 + 5 + @@ -1043,9 +1473,17 @@ Spain - 0000000-1399999 + 0000000-1199999 2 + + 1200000-1299999 + 6 + + + 1300000-1399999 + 4 + 1400000-1499999 3 @@ -1101,9 +1539,65 @@ 2 - 2000000-5499999 + 2000000-4549999 3 + + 4550000-4552999 + 6 + + + 4553000-4559999 + 5 + + + 4560000-5289999 + 3 + + + 5290000-5319999 + 5 + + + 5320000-5339999 + 4 + + + 5340000-5399999 + 3 + + + 5400000-5402999 + 5 + + + 5403000-5403999 + 5 + + + 5404000-5404999 + 6 + + + 5405000-5408999 + 5 + + + 5409000-5409999 + 6 + + + 5410000-5439999 + 5 + + + 5440000-5479999 + 4 + + + 5480000-5499999 + 5 + 5500000-5999999 4 @@ -1219,7 +1713,47 @@ 2 - 2000000-5999999 + 2000000-3119999 + 3 + + + 3120000-3149999 + 5 + + + 3150000-3189999 + 3 + + + 3190000-3229999 + 5 + + + 3230000-3269999 + 3 + + + 3270000-3389999 + 4 + + + 3390000-3609999 + 3 + + + 3610000-3629999 + 4 + + + 3630000-5489999 + 3 + + + 5490000-5549999 + 4 + + + 5550000-5999999 3 @@ -1235,19 +1769,19 @@ 6 - 9100000-9299999 + 9100000-9269999 3 - 9300000-9399999 + 9270000-9399999 4 - 9400000-9499999 + 9400000-9479999 6 - 9500000-9999999 + 9480000-9999999 5 @@ -1353,11 +1887,11 @@ 0 - 7000000-7999999 + 7000000-8199999 4 - 8000000-8499999 + 8200000-8499999 0 @@ -1555,9 +2089,21 @@ 2 - 1500000-5099999 + 1500000-4799999 3 + + 4800000-4999999 + 5 + + + 5000000-5009999 + 3 + + + 5010000-5099999 + 5 + 5100000-5499999 2 @@ -1615,19 +2161,31 @@ 4 - 2000000-3899999 + 2000000-3399999 2 + + 3400000-3549999 + 4 + + + 3550000-3599999 + 5 + + + 3600000-3799999 + 4 + + + 3800000-3899999 + 5 + 3900000-4099999 4 - 4100000-4399999 - 5 - - - 4400000-4499999 + 4100000-4499999 5 @@ -1639,15 +2197,15 @@ 5 - 5500000-7499999 + 5500000-7109999 3 - 7500000-7999999 - 4 + 7110000-7149999 + 5 - 8000000-9499999 + 7150000-9499999 4 @@ -1661,13 +2219,25 @@ Chile - 0000000-1999999 + 0000000-0899999 2 - 2000000-6999999 + 0900000-0999999 + 5 + + + 1000000-1999999 + 2 + + + 2000000-5999999 3 + + 6000000-6999999 + 4 + 7000000-9999999 4 @@ -1725,11 +2295,23 @@ Colombia - 0000000-5699999 + 0000000-5099999 2 - 5700000-5999999 + 5100000-5199999 + 4 + + + 5200000-5399999 + 5 + + + 5400000-5599999 + 4 + + + 5600000-5999999 5 @@ -1827,11 +2409,11 @@ 4 - 9000000-9499999 + 9000000-9599999 5 - 9500000-9999999 + 9600000-9999999 0 @@ -2043,9 +2625,17 @@ 4 - 2500000-2999999 + 2500000-2549999 + 3 + + + 2550000-2899999 0 + + 2900000-2999999 + 4 + 3000000-4999999 3 @@ -2311,9 +2901,13 @@ 5 - 0200000-2499999 + 0200000-2399999 2 + + 2400000-2499999 + 4 + 2500000-5999999 3 @@ -2383,9 +2977,13 @@ 5 - 9000000-9999999 + 9000000-9899999 2 + + 9900000-9999999 + 3 + @@ -2479,9 +3077,13 @@ 2 - 1700000-1999999 + 1700000-1799999 5 + + 1800000-1999999 + 2 + 2000000-2999999 3 @@ -2603,9 +3205,13 @@ 3 - 6000000-8999999 + 6000000-8799999 4 + + 8800000-8999999 + 3 + 9000000-9999999 5 @@ -2621,11 +3227,11 @@ 2 - 1200000-5599999 + 1200000-5399999 3 - 5600000-7999999 + 5400000-7999999 4 @@ -2679,9 +3285,17 @@ 4 - 5000000-8999999 + 5000000-8299999 3 + + 8300000-8499999 + 4 + + + 8500000-8999999 + 2 + 9000000-9499999 4 @@ -2701,21 +3315,17 @@ 2 - 1200000-1499999 + 1200000-1999999 5 - 1500000-1699999 - 5 - - - 1700000-1999999 - 5 - - - 2000000-7699999 + 2000000-7399999 3 + + 7400000-7699999 + 5 + 7700000-7999999 5 @@ -2739,9 +3349,13 @@ 1 - 2000000-5499999 + 2000000-5399999 2 + + 5400000-5499999 + 5 + 5500000-7999999 3 @@ -2756,6 +3370,322 @@ + + 978-9914 + Kenya + + + 0000000-3999999 + 0 + + + 4000000-4499999 + 2 + + + 4500000-6999999 + 0 + + + 7000000-7499999 + 3 + + + 7500000-9849999 + 0 + + + 9850000-9999999 + 4 + + + + + 978-9915 + Uruguay + + + 0000000-3999999 + 0 + + + 4000000-5999999 + 2 + + + 6000000-6499999 + 0 + + + 6500000-7999999 + 3 + + + 8000000-9299999 + 0 + + + 9300000-9999999 + 4 + + + + + 978-9916 + Estonia + + + 0000000-0999999 + 1 + + + 1000000-3999999 + 2 + + + 4000000-4999999 + 1 + + + 5000000-5999999 + 0 + + + 6000000-7499999 + 3 + + + 7500000-9499999 + 0 + + + 9500000-9999999 + 4 + + + + + 978-9917 + Bolivia + + + 0000000-0999999 + 1 + + + 1000000-2999999 + 0 + + + 3000000-3499999 + 2 + + + 3500000-5999999 + 0 + + + 6000000-6999999 + 3 + + + 7000000-9799999 + 0 + + + 9800000-9999999 + 4 + + + + + 978-9918 + Malta + + + 0000000-0999999 + 1 + + + 1000000-1999999 + 0 + + + 2000000-2999999 + 2 + + + 3000000-5999999 + 0 + + + 6000000-7999999 + 3 + + + 8000000-9499999 + 0 + + + 9500000-9999999 + 4 + + + + + 978-9919 + Mongolia + + + 0000000-1999999 + 0 + + + 2000000-2799999 + 2 + + + 2800000-4999999 + 0 + + + 5000000-5999999 + 3 + + + 6000000-9499999 + 0 + + + 9500000-9999999 + 4 + + + + + 978-9920 + Morocco + + + 0000000-3499999 + 0 + + + 3500000-3999999 + 2 + + + 4000000-5999999 + 0 + + + 6000000-7999999 + 3 + + + 8000000-9299999 + 0 + + + 9300000-9999999 + 4 + + + + + 978-9921 + Kuwait + + + 0000000-0999999 + 1 + + + 1000000-2999999 + 0 + + + 3000000-3999999 + 2 + + + 4000000-6999999 + 0 + + + 7000000-8999999 + 3 + + + 9000000-9699999 + 0 + + + 9700000-9999999 + 4 + + + + + 978-9922 + Iraq + + + 0000000-1999999 + 0 + + + 2000000-2999999 + 2 + + + 3000000-5999999 + 0 + + + 6000000-7999999 + 3 + + + 8000000-8999999 + 0 + + + 9000000-9999999 + 4 + + + + + 978-9923 + Jordan + + + 0000000-0999999 + 1 + + + 1000000-4999999 + 2 + + + 5000000-6999999 + 0 + + + 7000000-8999999 + 3 + + + 9000000-9699999 + 0 + + + 9700000-9999999 + 4 + + + 978-9924 Cambodia @@ -3095,9 +4025,13 @@ 3 - 9000000-9999999 + 9000000-9799999 4 + + 9800000-9999999 + 2 + @@ -3113,11 +4047,15 @@ 2 - 5000000-8999999 + 5000000-8399999 3 - 9000000-9999999 + 8400000-8699999 + 2 + + + 8700000-9999999 4 @@ -3135,9 +4073,13 @@ 2 - 4000000-8999999 + 4000000-7999999 3 + + 8000000-8999999 + 1 + 9000000-9999999 4 @@ -3149,9 +4091,13 @@ Ecuador - 0000000-8499999 + 0000000-7499999 2 + + 7500000-8499999 + 3 + 8500000-8999999 4 @@ -3247,7 +4193,15 @@ 2 - 5800000-8499999 + 5800000-7999999 + 3 + + + 8000000-8099999 + 2 + + + 8100000-8499999 3 @@ -3319,17 +4273,29 @@ Estonia - 0000000-0999999 - 1 + 0000000-0899999 + 2 + + + 0900000-0999999 + 3 1000000-3999999 2 - 4000000-7499999 + 4000000-6999999 3 + + 7000000-7199999 + 2 + + + 7200000-7499999 + 4 + 7500000-8999999 2 @@ -3419,9 +4385,17 @@ 2 - 9000000-9999999 + 9000000-9299999 4 + + 9300000-9699999 + 2 + + + 9700000-9999999 + 3 + @@ -3441,9 +4415,13 @@ 3 - 8000000-9999999 + 8000000-9899999 4 + + 9900000-9999999 + 2 + @@ -3499,9 +4477,13 @@ 3 - 6500000-6999999 + 6500000-6799999 2 + + 6800000-6999999 + 3 + 7000000-8499999 2 @@ -3737,9 +4719,13 @@ Kenya - 0000000-1499999 + 0000000-1399999 3 + + 1400000-1499999 + 2 + 1500000-1999999 4 @@ -3753,7 +4739,23 @@ 4 - 7500000-9599999 + 7500000-8209999 + 3 + + + 8210000-8249999 + 4 + + + 8250000-8259999 + 3 + + + 8260000-8289999 + 4 + + + 8290000-9599999 3 @@ -3919,9 +4921,13 @@ 3 - 7500000-9099999 + 7500000-8799999 4 + + 8800000-9099999 + 3 + 9100000-9499999 2 @@ -3971,11 +4977,19 @@ Tanzania - 0000000-5999999 + 0000000-4999999 1 - 6000000-8999999 + 5000000-5799999 + 4 + + + 5800000-5899999 + 3 + + + 5900000-8999999 2 @@ -4262,7 +5276,7 @@ 978-9989 - Macedonia + North Macedonia 0000000-0999999 @@ -4520,14 +5534,22 @@ 978-99914 - Suriname + International NGO Publishers 0000000-4999999 1 - 5000000-8999999 + 5000000-6999999 + 2 + + + 7000000-7999999 + 1 + + + 8000000-8999999 2 @@ -4581,11 +5603,11 @@ 1 - 3000000-8999999 + 3000000-8899999 2 - 9000000-9999999 + 8900000-9999999 3 @@ -4621,23 +5643,11 @@ 3 - 4000000-6999999 + 4000000-7999999 2 - 7000000-7999999 - 2 - - - 8000000-8499999 - 3 - - - 8500000-8999999 - 3 - - - 9000000-9999999 + 8000000-9999999 3 @@ -5361,9 +6371,13 @@ 2 - 8000000-9999999 + 8000000-9499999 3 + + 9500000-9999999 + 2 + @@ -5411,8 +6425,12 @@ Malawi - 0000000-0999999 - 1 + 0000000-0699999 + 0 + + + 0700000-0999999 + 3 1000000-9499999 @@ -5429,11 +6447,15 @@ El Salvador - 0000000-3999999 + 0000000-2999999 1 - 4000000-8999999 + 3000000-3699999 + 3 + + + 3700000-8999999 2 @@ -5501,11 +6523,15 @@ Macau - 0000000-3999999 + 0000000-2999999 1 - 4000000-6299999 + 3000000-3599999 + 3 + + + 3600000-6299999 2 @@ -5531,12 +6557,12 @@ 3 - 8000000-9499999 + 8000000-9699999 2 - 9500000-9999999 - 0 + 9700000-9999999 + 3 @@ -5545,21 +6571,17 @@ Paraguay - 0000000-1999999 + 0000000-0999999 1 - 2000000-5999999 + 1000000-5999999 2 - 6000000-8999999 + 6000000-9999999 3 - - 9000000-9999999 - 0 - @@ -5625,11 +6647,11 @@ Myanmar - 0000000-5999999 + 0000000-3999999 1 - 6000000-8499999 + 4000000-8499999 2 @@ -5679,11 +6701,27 @@ Bolivia - 0000000-3999999 - 0 + 0000000-0999999 + 1 - 4000000-7999999 + 1000000-2599999 + 2 + + + 2600000-3999999 + 3 + + + 4000000-6399999 + 2 + + + 6400000-6499999 + 3 + + + 6500000-7999999 2 @@ -5697,9 +6735,13 @@ Tajikistan - 0000000-3999999 + 0000000-2999999 1 + + 3000000-3999999 + 3 + 4000000-7999999 2 @@ -5727,9 +6769,13 @@ 3 - 8000000-9999999 + 8000000-8999999 0 + + 9000000-9999999 + 3 + @@ -5753,9 +6799,179 @@ 3 - 8000000-9999999 + 8000000-9949999 0 + + 9950000-9999999 + 3 + + + + + 978-99978 + Mongolia + + + 0000000-4999999 + 1 + + + 5000000-6999999 + 2 + + + 7000000-9999999 + 3 + + + + + 978-99979 + Honduras + + + 0000000-4999999 + 1 + + + 5000000-7999999 + 2 + + + 8000000-9999999 + 3 + + + + + 978-99980 + Bhutan + + + 0000000-0999999 + 1 + + + 1000000-2999999 + 0 + + + 3000000-5999999 + 2 + + + 6000000-7999999 + 0 + + + 8000000-9999999 + 3 + + + + + 978-99981 + Macau + + + 0000000-1999999 + 1 + + + 2000000-2999999 + 0 + + + 3000000-4999999 + 2 + + + 5000000-7999999 + 0 + + + 8000000-9999999 + 3 + + + + + 978-99982 + Benin + + + 0000000-0999999 + 1 + + + 1000000-4999999 + 0 + + + 5000000-6299999 + 2 + + + 6300000-8999999 + 0 + + + 9000000-9699999 + 3 + + + 9700000-9999999 + 0 + + + + + 978-99983 + El Salvador + + + 0000000-0999999 + 1 + + + 1000000-4999999 + 0 + + + 5000000-6999999 + 2 + + + 7000000-9499999 + 0 + + + 9500000-9999999 + 3 + + + + + 978-99985 + Tajikistan + + + 0000000-5499999 + 0 + + + 5500000-5999999 + 2 + + + 6000000-9499999 + 0 + + + 9500000-9999999 + 3 + @@ -5819,11 +7035,45 @@ 0 - 2000000-2009999 + 2000000-2999999 3 - 2010000-9999999 + 3000000-7999999 + 0 + + + 8000000-8499999 + 5 + + + 8500000-9999999 + 0 + + + + + 979-8 + United States + + + 0000000-5999999 + 0 + + + 6000000-6999999 + 4 + + + 7000000-9849999 + 0 + + + 9850000-9850009 + 7 + + + 9850010-9999999 0 diff --git a/src/test/java/org/xbib/standardnumber/DOITests.java b/src/test/java/org/xbib/standardnumber/DOITests.java index 18c5279..58687fa 100644 --- a/src/test/java/org/xbib/standardnumber/DOITests.java +++ b/src/test/java/org/xbib/standardnumber/DOITests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/EANTests.java b/src/test/java/org/xbib/standardnumber/EANTests.java index a513b91..3040c35 100644 --- a/src/test/java/org/xbib/standardnumber/EANTests.java +++ b/src/test/java/org/xbib/standardnumber/EANTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/GTINTests.java b/src/test/java/org/xbib/standardnumber/GTINTests.java index 43293b4..09a1986 100644 --- a/src/test/java/org/xbib/standardnumber/GTINTests.java +++ b/src/test/java/org/xbib/standardnumber/GTINTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/IBANTests.java b/src/test/java/org/xbib/standardnumber/IBANTests.java index 7fad23e..fde86a5 100644 --- a/src/test/java/org/xbib/standardnumber/IBANTests.java +++ b/src/test/java/org/xbib/standardnumber/IBANTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/ISANTests.java b/src/test/java/org/xbib/standardnumber/ISANTests.java index 00643fb..210ea58 100644 --- a/src/test/java/org/xbib/standardnumber/ISANTests.java +++ b/src/test/java/org/xbib/standardnumber/ISANTests.java @@ -1,10 +1,9 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/ISBNTests.java b/src/test/java/org/xbib/standardnumber/ISBNTests.java index f874288..ae7da68 100644 --- a/src/test/java/org/xbib/standardnumber/ISBNTests.java +++ b/src/test/java/org/xbib/standardnumber/ISBNTests.java @@ -1,8 +1,8 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * @@ -14,9 +14,10 @@ public class ISBNTests { assertEquals("000111333", new ISBN().set("000-111-333").normalize().normalizedValue()); } - @Test(expected = IllegalArgumentException.class) - public void testISBNTooShort() throws Exception { - new ISBN().set("12-7").normalize().verify(); + @Test + public void testISBNTooShort() { + Assertions.assertThrows(IllegalArgumentException.class, () -> + new ISBN().set("12-7").normalize().verify()); } @Test @@ -26,10 +27,12 @@ public class ISBNTests { assertEquals(isbn.normalizedValue(), "3980335054"); } - @Test(expected = NumberFormatException.class) - public void testTruncatedISBN() throws Exception { - String value = "ISBN"; - new ISBN().set(value).normalize().verify(); + @Test + public void testTruncatedISBN() { + Assertions.assertThrows(NumberFormatException.class, () -> { + String value = "ISBN"; + new ISBN().set(value).normalize().verify(); + }); } @Test @@ -40,7 +43,7 @@ public class ISBNTests { } @Test - public void testEAN() throws Exception { + public void testEAN() { String value = "978-3-551-75213-0"; StandardNumber isbn = new ISBN().ean(true).set(value).normalize().verify(); assertEquals("9783551752130", isbn.normalizedValue()); @@ -48,22 +51,24 @@ public class ISBNTests { } @Test - public void testEAN2() throws Exception { + public void testEAN2() { String value = "978-3-551-75213-1"; StandardNumber isbn = new ISBN().ean(true).set(value).createChecksum(true).normalize().verify(); assertEquals("9783551752130", isbn.normalizedValue()); assertEquals("978-3-551-75213-0", isbn.format()); } - @Test(expected = NumberFormatException.class) - public void testWrongAndDirtyEAN() throws Exception { - // correct ISBN-10 is 3-451-04112-X - String value = "ISBN ISBN 3-451-4112-X kart. : DM 24.80"; - new ISBN().ean(false).set(value).createChecksum(true).normalize().verify(); + @Test + public void testWrongAndDirtyEAN() { + Assertions.assertThrows(NumberFormatException.class, () ->{ + // correct ISBN-10 is 3-451-04112-X + String value = "ISBN ISBN 3-451-4112-X kart. : DM 24.80"; + new ISBN().ean(false).set(value).createChecksum(true).normalize().verify(); + }); } @Test - public void testVariants() throws Exception { + public void testVariants() { String content = "1-9339-8817-7."; ISBN isbn = new ISBN(); isbn.set(content).normalize(); diff --git a/src/test/java/org/xbib/standardnumber/ISMNTests.java b/src/test/java/org/xbib/standardnumber/ISMNTests.java index 02ab623..7f3b683 100644 --- a/src/test/java/org/xbib/standardnumber/ISMNTests.java +++ b/src/test/java/org/xbib/standardnumber/ISMNTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/ISNITests.java b/src/test/java/org/xbib/standardnumber/ISNITests.java index cb85ad0..8a4a860 100644 --- a/src/test/java/org/xbib/standardnumber/ISNITests.java +++ b/src/test/java/org/xbib/standardnumber/ISNITests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/ISSNTests.java b/src/test/java/org/xbib/standardnumber/ISSNTests.java index de281b6..fd20bf0 100644 --- a/src/test/java/org/xbib/standardnumber/ISSNTests.java +++ b/src/test/java/org/xbib/standardnumber/ISSNTests.java @@ -1,13 +1,12 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * */ - public class ISSNTests { @Test @@ -37,9 +36,11 @@ public class ISSNTests { assertEquals(issn.createChecksum(true).toGTIN("03").normalizedValue(), "9770729011038"); } - @Test(expected = NumberFormatException.class) - public void testNonISSN() throws Exception { - String value = "linux"; - new ISSN().set(value).createChecksum(true).normalize().verify(); + @Test + public void testNonISSN() { + Assertions.assertThrows(NumberFormatException.class, () -> { + String value = "linux"; + new ISSN().set(value).createChecksum(true).normalize().verify(); + }); } } diff --git a/src/test/java/org/xbib/standardnumber/ISTCTests.java b/src/test/java/org/xbib/standardnumber/ISTCTests.java index cc28a2c..aae1219 100644 --- a/src/test/java/org/xbib/standardnumber/ISTCTests.java +++ b/src/test/java/org/xbib/standardnumber/ISTCTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/ISWCTests.java b/src/test/java/org/xbib/standardnumber/ISWCTests.java index d708bd3..1d4fa70 100644 --- a/src/test/java/org/xbib/standardnumber/ISWCTests.java +++ b/src/test/java/org/xbib/standardnumber/ISWCTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * @@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals; public class ISWCTests { @Test - public void testISWC() throws Exception { + public void testISWC() { StandardNumber iswc = new ISWC().set("T-034524680-1").normalize().verify(); assertEquals("T0345246801", iswc.normalizedValue()); assertEquals("ISWC T-034524680-1", iswc.format()); diff --git a/src/test/java/org/xbib/standardnumber/ORCIDTests.java b/src/test/java/org/xbib/standardnumber/ORCIDTests.java index 8ec189a..c1418a2 100644 --- a/src/test/java/org/xbib/standardnumber/ORCIDTests.java +++ b/src/test/java/org/xbib/standardnumber/ORCIDTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/PPNTests.java b/src/test/java/org/xbib/standardnumber/PPNTests.java index bc554e3..e793672 100644 --- a/src/test/java/org/xbib/standardnumber/PPNTests.java +++ b/src/test/java/org/xbib/standardnumber/PPNTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * diff --git a/src/test/java/org/xbib/standardnumber/SICITests.java b/src/test/java/org/xbib/standardnumber/SICITests.java index 4f17552..9380f22 100644 --- a/src/test/java/org/xbib/standardnumber/SICITests.java +++ b/src/test/java/org/xbib/standardnumber/SICITests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * @@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals; public class SICITests { @Test - public void testSICI1() throws Exception { + public void testSICI1() { StandardNumber sici = new SICI().set("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J").normalize().verify(); assertEquals("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.normalizedValue()); assertEquals("SICI 0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.format()); diff --git a/src/test/java/org/xbib/standardnumber/UPCTests.java b/src/test/java/org/xbib/standardnumber/UPCTests.java index 9c407d8..06612e5 100644 --- a/src/test/java/org/xbib/standardnumber/UPCTests.java +++ b/src/test/java/org/xbib/standardnumber/UPCTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * @@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals; public class UPCTests { @Test - public void testUPC() throws Exception { + public void testUPC() { String value = "796030114977"; StandardNumber upc = new UPC().set(value).normalize().verify(); assertEquals("796030114977", upc.normalizedValue()); @@ -18,7 +17,7 @@ public class UPCTests { } @Test - public void testUPC2() throws Exception { + public void testUPC2() { String value = "036000291452"; StandardNumber upc = new UPC().set(value).normalize().verify(); assertEquals("036000291452", upc.normalizedValue()); diff --git a/src/test/java/org/xbib/standardnumber/ZDBTests.java b/src/test/java/org/xbib/standardnumber/ZDBTests.java index ff44713..39f2e27 100644 --- a/src/test/java/org/xbib/standardnumber/ZDBTests.java +++ b/src/test/java/org/xbib/standardnumber/ZDBTests.java @@ -1,8 +1,7 @@ package org.xbib.standardnumber; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * @@ -10,23 +9,22 @@ import static org.junit.Assert.assertEquals; public class ZDBTests { @Test - public void testZDB1() throws Exception { + public void testZDB1() { StandardNumber zdb = new ZDB().set("127").normalize().verify(); assertEquals("127", zdb.normalizedValue()); } @Test - public void testZDB2() throws Exception { + public void testZDB2() { StandardNumber zdb = new ZDB().set("127976-2").normalize().verify(); assertEquals("1279762", zdb.normalizedValue()); assertEquals("127976-2", zdb.format()); } @Test - public void testZDB3() throws Exception { + public void testZDB3() { StandardNumber zdb = new ZDB().set("1279760").createChecksum(true).normalize().verify(); assertEquals("1279762", zdb.normalizedValue()); assertEquals("127976-2", zdb.format()); } - }