diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 39f81d44..3712caf4 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -28,6 +28,7 @@ Maintenance::
* Rewrite `AsciidoctorHttpMojoTest` to Java to make it more approachable (#516)
* Rewrite `AsciidoctorZipMojoTest` to Java to make it more approachable (#518)
* Rewrite `AsciidoctorDoxiaParserTest` to Java + remove Groovy & Spock configurations (#519)
+ * Upgrade tests to JUni5 (#521)
== v2.1.0 (2020-09-15)
diff --git a/pom.xml b/pom.xml
index 7c518700..4a090a14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,18 @@
1.8
+
+
+
+ org.junit
+ junit-bom
+ 5.7.1
+ pom
+ import
+
+
+
+
org.jruby
@@ -143,27 +155,25 @@
${doxia.version}
- junit
- junit
- 4.13
- test
+ org.junit.jupiter
+ junit-jupiter
org.assertj
assertj-core
- 3.16.1
+ 3.19.0
test
org.mockito
mockito-core
- 3.3.0
+ 3.8.0
test
org.projectlombok
lombok
- 1.18.12
+ 1.18.18
test
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorHttpMojoTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorHttpMojoTest.java
index f1cd5c7c..40753131 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorHttpMojoTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorHttpMojoTest.java
@@ -7,7 +7,7 @@
import org.apache.maven.plugin.MojoFailureException;
import org.asciidoctor.maven.io.TestFilesHelper;
import org.asciidoctor.maven.io.UserInputSimulator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorIntegrationTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorIntegrationTest.java
index 9435e2f1..e1902682 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorIntegrationTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorIntegrationTest.java
@@ -3,8 +3,8 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.assertj.core.api.Assertions;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.io.File;
@@ -188,7 +188,7 @@ public void should_apply_code_highlighting_with_prettify() throws MojoFailureExc
.contains("prettify");
}
- @Ignore("Not supported in Asciidoctorj (gem not embedded)")
+ @Disabled("Not supported in Asciidoctorj (gem not embedded)")
@Test
public void should_apply_code_highlighting_with_pygments() throws MojoFailureException, MojoExecutionException {
// given
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoExtensionsTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoExtensionsTest.java
index 07d6f427..1bbe489d 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoExtensionsTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoExtensionsTest.java
@@ -7,8 +7,8 @@
import org.asciidoctor.maven.io.ConsoleHolder;
import org.asciidoctor.maven.test.processors.*;
import org.assertj.core.api.Assertions;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.Arrays;
@@ -374,7 +374,7 @@ public void should_convert_to_html_using_all_extension_types() throws MojoFailur
* To execute, copy _org.asciidoctor.extension.spi.ExtensionRegistry to
* /src/test/resources/META-INF/services/ and execute
*/
- @Ignore
+ @Disabled
@Test
public void property_extension() throws MojoFailureException, MojoExecutionException {
// given
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoLogHandlerTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoLogHandlerTest.java
index 4f044a71..137462b8 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoLogHandlerTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoLogHandlerTest.java
@@ -5,8 +5,9 @@
import org.asciidoctor.maven.io.ConsoleHolder;
import org.asciidoctor.maven.log.FailIf;
import org.asciidoctor.maven.log.LogHandler;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import java.io.File;
import java.util.Arrays;
@@ -129,7 +130,7 @@ public void should_not_fail_and_log_errors_as_INFO_when_outputToConsole_is_set()
consoleHolder.release();
}
- @Ignore
+ @Disabled
@Test
public void should_not_fail_and_log_errors_as_INFO_when_outputToConsole_is_set_and_doc_contains_messages_without_cursor_and_verbose_is_enabled() throws MojoFailureException, MojoExecutionException {
// setup
@@ -169,7 +170,7 @@ public void should_not_fail_and_log_errors_as_INFO_when_outputToConsole_is_set_a
}
- @Ignore
+ @Disabled
@Test
public void should_not_fail_and_log_verbose_errors_when_gempath_is_set() throws MojoFailureException, MojoExecutionException {
// setup
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoTest.java
index 8d85b572..117b30b2 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorMojoTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorMojoTest.java
@@ -10,7 +10,7 @@
import org.asciidoctor.maven.io.ConsoleHolder;
import org.asciidoctor.maven.test.processors.RequireCheckerTreeprocessor;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.*;
import java.nio.file.Files;
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorRefreshMojoTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorRefreshMojoTest.java
index 018883c8..bfb4a89e 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorRefreshMojoTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorRefreshMojoTest.java
@@ -12,7 +12,7 @@
import org.asciidoctor.maven.TestUtils.ResourceBuilder;
import org.asciidoctor.maven.io.ConsoleHolder;
import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.sonatype.plexus.build.incremental.BuildContext;
import org.sonatype.plexus.build.incremental.DefaultBuildContext;
diff --git a/src/test/java/org/asciidoctor/maven/AsciidoctorZipMojoTest.java b/src/test/java/org/asciidoctor/maven/AsciidoctorZipMojoTest.java
index c03f3b95..d341ca8e 100644
--- a/src/test/java/org/asciidoctor/maven/AsciidoctorZipMojoTest.java
+++ b/src/test/java/org/asciidoctor/maven/AsciidoctorZipMojoTest.java
@@ -4,7 +4,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.asciidoctor.maven.io.TestFilesHelper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
diff --git a/src/test/java/org/asciidoctor/maven/SourceDirectoryFinderTest.java b/src/test/java/org/asciidoctor/maven/SourceDirectoryFinderTest.java
index 83516d68..62cfc87f 100644
--- a/src/test/java/org/asciidoctor/maven/SourceDirectoryFinderTest.java
+++ b/src/test/java/org/asciidoctor/maven/SourceDirectoryFinderTest.java
@@ -1,12 +1,10 @@
package org.asciidoctor.maven;
import org.asciidoctor.maven.process.SourceDirectoryFinder;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import java.io.File;
-import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
@@ -16,8 +14,8 @@
public class SourceDirectoryFinderTest {
- @Rule
- public TemporaryFolder testFolder = new TemporaryFolder();
+ @TempDir
+ public File testDirectory;
private static final File MOJO_DEFAULT_SOURCE_DIR = new File(SourceDirectoryFinder.DEFAULT_SOURCE_DIR);
private static final File[] FALLBACK_CANDIDATES = new File[]{
@@ -30,9 +28,8 @@ public class SourceDirectoryFinderTest {
@Test
- public void should_not_try_candidates_and_not_find_when_initial_does_not_match_default_value() throws IOException {
+ public void should_not_try_candidates_and_not_find_when_initial_does_not_match_default_value() {
// given
- final File testDirectory = testFolder.newFolder();
final File fakePath = new File("fake_path");
// when
@@ -46,9 +43,8 @@ public void should_not_try_candidates_and_not_find_when_initial_does_not_match_d
}
@Test
- public void should_not_try_candidates_and_find_when_initial_does_not_match_default_value() throws IOException {
+ public void should_not_try_candidates_and_find_when_initial_does_not_match_default_value() {
// given
- final File testDirectory = testFolder.newFolder();
final File fakePath = new File("fake_path");
new File(testDirectory, fakePath.toString()).mkdirs();
@@ -61,9 +57,8 @@ public void should_not_try_candidates_and_find_when_initial_does_not_match_defau
}
@Test
- public void should_find_default_candidate_when_set_as_relative_path() throws IOException {
+ public void should_find_default_candidate_when_set_as_relative_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = MOJO_DEFAULT_SOURCE_DIR;
new File(testDirectory, candidate.toString()).mkdirs();
@@ -78,9 +73,8 @@ public void should_find_default_candidate_when_set_as_relative_path() throws IOE
}
@Test
- public void should_find_default_candidate_when_set_as_absolute_path() throws IOException {
+ public void should_find_default_candidate_when_set_as_absolute_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = new File(testDirectory, MOJO_DEFAULT_SOURCE_DIR.toString());
candidate.mkdirs();
@@ -95,9 +89,8 @@ public void should_find_default_candidate_when_set_as_absolute_path() throws IOE
}
@Test
- public void should_find_first_fallback_candidate_when_set_as_relative_path() throws IOException {
+ public void should_find_first_fallback_candidate_when_set_as_relative_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = FALLBACK_CANDIDATES[0];
new File(testDirectory, FALLBACK_CANDIDATES[0].toString()).mkdirs();
final File defaultSourceDir = MOJO_DEFAULT_SOURCE_DIR;
@@ -113,9 +106,8 @@ public void should_find_first_fallback_candidate_when_set_as_relative_path() thr
}
@Test
- public void should_find_first_fallback_candidate_when_set_as_absolute_path() throws IOException {
+ public void should_find_first_fallback_candidate_when_set_as_absolute_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = new File(testDirectory, FALLBACK_CANDIDATES[0].toString());
candidate.mkdirs();
final File defaultSourceDir = MOJO_DEFAULT_SOURCE_DIR;
@@ -131,9 +123,8 @@ public void should_find_first_fallback_candidate_when_set_as_absolute_path() thr
}
@Test
- public void should_find_second_fallback_candidate_when_set_as_relative_path() throws IOException {
+ public void should_find_second_fallback_candidate_when_set_as_relative_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = FALLBACK_CANDIDATES[1];
new File(testDirectory, FALLBACK_CANDIDATES[1].toString()).mkdirs();
final File defaultSourceDir = MOJO_DEFAULT_SOURCE_DIR;
@@ -149,9 +140,8 @@ public void should_find_second_fallback_candidate_when_set_as_relative_path() th
}
@Test
- public void should_find_second_fallback_candidate_when_set_as_absolute_path() throws IOException {
+ public void should_find_second_fallback_candidate_when_set_as_absolute_path() {
// given
- final File testDirectory = testFolder.newFolder();
final File candidate = new File(testDirectory, FALLBACK_CANDIDATES[1].toString());
candidate.mkdirs();
final File defaultSourceDir = MOJO_DEFAULT_SOURCE_DIR;
@@ -167,9 +157,8 @@ public void should_find_second_fallback_candidate_when_set_as_absolute_path() th
}
@Test
- public void should_try_all_candidates_and_not_find_any_candidate_when_initial_is_default() throws IOException {
+ public void should_try_all_candidates_and_not_find_any_candidate_when_initial_is_default() {
// given
- final File testDirectory = testFolder.newFolder();
final File defaultSourceDir = MOJO_DEFAULT_SOURCE_DIR;
// when
diff --git a/src/test/java/org/asciidoctor/maven/http/AsciidoctorHttpServerTest.java b/src/test/java/org/asciidoctor/maven/http/AsciidoctorHttpServerTest.java
index 110d94e0..5abb1600 100644
--- a/src/test/java/org/asciidoctor/maven/http/AsciidoctorHttpServerTest.java
+++ b/src/test/java/org/asciidoctor/maven/http/AsciidoctorHttpServerTest.java
@@ -4,7 +4,7 @@
import lombok.Value;
import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.logging.Log;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.File;
diff --git a/src/test/java/org/asciidoctor/maven/log/LogRecordHelperTest.java b/src/test/java/org/asciidoctor/maven/log/LogRecordHelperTest.java
index 169eab92..632b8b76 100644
--- a/src/test/java/org/asciidoctor/maven/log/LogRecordHelperTest.java
+++ b/src/test/java/org/asciidoctor/maven/log/LogRecordHelperTest.java
@@ -3,7 +3,7 @@
import org.asciidoctor.ast.Cursor;
import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.File;
diff --git a/src/test/java/org/asciidoctor/maven/process/CustomExtensionDirectoryWalkerTest.java b/src/test/java/org/asciidoctor/maven/process/CustomExtensionDirectoryWalkerTest.java
index 52b80748..a4ab0b5c 100644
--- a/src/test/java/org/asciidoctor/maven/process/CustomExtensionDirectoryWalkerTest.java
+++ b/src/test/java/org/asciidoctor/maven/process/CustomExtensionDirectoryWalkerTest.java
@@ -1,6 +1,6 @@
package org.asciidoctor.maven.process;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.Collections;
diff --git a/src/test/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptorTest.java b/src/test/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptorTest.java
index a75b0963..3569801e 100644
--- a/src/test/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptorTest.java
+++ b/src/test/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptorTest.java
@@ -3,7 +3,7 @@
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.logging.Log;
import org.asciidoctor.maven.AsciidoctorRefreshMojo;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.File;
diff --git a/src/test/java/org/asciidoctor/maven/refresh/ResourcesPatternBuilderTest.java b/src/test/java/org/asciidoctor/maven/refresh/ResourcesPatternBuilderTest.java
index 10fc0d0c..3218ed1c 100644
--- a/src/test/java/org/asciidoctor/maven/refresh/ResourcesPatternBuilderTest.java
+++ b/src/test/java/org/asciidoctor/maven/refresh/ResourcesPatternBuilderTest.java
@@ -1,6 +1,6 @@
package org.asciidoctor.maven.refresh;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
diff --git a/src/test/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserTest.java b/src/test/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserTest.java
index 69457b95..4c28b7d1 100644
--- a/src/test/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserTest.java
+++ b/src/test/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserTest.java
@@ -6,7 +6,7 @@
import org.apache.maven.doxia.sink.impl.AbstractTextSink;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.*;
diff --git a/src/test/java/org/asciidoctor/maven/site/SiteConversionConfigurationParserTest.java b/src/test/java/org/asciidoctor/maven/site/SiteConversionConfigurationParserTest.java
index 6c4b5ad5..274b9d5b 100644
--- a/src/test/java/org/asciidoctor/maven/site/SiteConversionConfigurationParserTest.java
+++ b/src/test/java/org/asciidoctor/maven/site/SiteConversionConfigurationParserTest.java
@@ -5,7 +5,7 @@
import org.asciidoctor.AttributesBuilder;
import org.asciidoctor.OptionsBuilder;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.AbstractMap;
diff --git a/src/test/java/org/asciidoctor/maven/site/SiteLogHandlerDeserializerTest.java b/src/test/java/org/asciidoctor/maven/site/SiteLogHandlerDeserializerTest.java
index 86b49924..46883159 100644
--- a/src/test/java/org/asciidoctor/maven/site/SiteLogHandlerDeserializerTest.java
+++ b/src/test/java/org/asciidoctor/maven/site/SiteLogHandlerDeserializerTest.java
@@ -4,7 +4,7 @@
import org.asciidoctor.maven.log.FailIf;
import org.asciidoctor.maven.log.LogHandler;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
diff --git a/src/test/java/org/asciidoctor/maven/test/processors/RequireCheckerTreeprocessor.java b/src/test/java/org/asciidoctor/maven/test/processors/RequireCheckerTreeprocessor.java
index b2165b38..52740959 100644
--- a/src/test/java/org/asciidoctor/maven/test/processors/RequireCheckerTreeprocessor.java
+++ b/src/test/java/org/asciidoctor/maven/test/processors/RequireCheckerTreeprocessor.java
@@ -4,15 +4,15 @@
import org.asciidoctor.extension.Treeprocessor;
import org.asciidoctor.jruby.internal.JRubyRuntimeContext;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class RequireCheckerTreeprocessor extends Treeprocessor {
- @Override
- public Document process(Document document) {
- assertEquals("constant", JRubyRuntimeContext.get(document).evalScriptlet("defined? ::DateTime").toString());
- // Leave a trace in the converted document so that the test can check that I was called
- document.getBlocks().add(createBlock(document, "paragraph", RequireCheckerTreeprocessor.class.getSimpleName() + " was here"));
- return document;
- }
+ @Override
+ public Document process(Document document) {
+ assertEquals("constant", JRubyRuntimeContext.get(document).evalScriptlet("defined? ::DateTime").toString());
+ // Leave a trace in the converted document so that the test can check that I was called
+ document.getBlocks().add(createBlock(document, "paragraph", RequireCheckerTreeprocessor.class.getSimpleName() + " was here"));
+ return document;
+ }
}