Avoid use of Rules which seem to break the order of events in Arquillian
MODIFY
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsLoadedToDocument.java
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsLoadedToDocument.java
package org.asciidoctor;
import org.asciidoctor.arquillian.api.Unshared;
-import org.asciidoctor.ast.*;
+import org.asciidoctor.ast.Author;
+import org.asciidoctor.ast.Document;
+import org.asciidoctor.ast.RevisionInfo;
+import org.asciidoctor.ast.Section;
+import org.asciidoctor.ast.StructuralNode;
import org.asciidoctor.jruby.internal.IOUtils;
import org.asciidoctor.util.ClasspathResources;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

MODIFY
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/HighlightJsHighlighterTest.java
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/HighlightJsHighlighterTest.java
@@ -29,8 +29,8 @@ public class HighlightJsHighlighterTest {
@ArquillianResource
private ClasspathResources classpathResources;
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @ArquillianResource
+ public TemporaryFolder tempDir;
@Test
public void should_invoke_syntax_highlighter() throws Exception {

MODIFY
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/OrderTest.java
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/OrderTest.java
package org.asciidoctor.integrationguide.syntaxhighlighter;
import org.asciidoctor.Asciidoctor;
-import org.asciidoctor.AttributesBuilder;
-import org.asciidoctor.OptionsBuilder;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.Options;
import org.asciidoctor.SafeMode;
import org.asciidoctor.util.ClasspathResources;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
@@ -27,8 +26,8 @@ public class OrderTest {
@ArquillianResource
private ClasspathResources classpathResources;
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @ArquillianResource
+ public TemporaryFolder tempDir;
@Test
public void should_invoke_syntax_highlighter() throws Exception {
@@ -45,14 +44,16 @@ public class OrderTest {
.register(OrderDocumentingHighlighter.class, "order");
asciidoctor.convertFile(sources_adoc,
- OptionsBuilder.options()
+ Options.builder()
.headerFooter(true)
.toDir(toDir)
.safe(SafeMode.UNSAFE)
- .attributes(AttributesBuilder.attributes()
+ .attributes(Attributes.builder()
.sourceHighlighter("order")
.copyCss(true)
- .linkCss(true)));
+ .linkCss(true)
+ .build())
+ .build());
String actual = OrderDocumentingHighlighter.messages.stream()
.map(msg -> ". " + msg + "\n")

MODIFY
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/PrismJsHighlighterTest.java
asciidoctorj-documentation/src/test/java/org/asciidoctor/integrationguide/syntaxhighlighter/PrismJsHighlighterTest.java
package org.asciidoctor.integrationguide.syntaxhighlighter;
-import org.apache.commons.io.IOUtils;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.AttributesBuilder;
import org.asciidoctor.OptionsBuilder;
@@ -11,21 +10,14 @@ import org.jboss.arquillian.test.api.ArquillianResource;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import java.io.File;
-import java.io.FileReader;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
@RunWith(Arquillian.class)
public class PrismJsHighlighterTest {
@@ -36,8 +28,8 @@ public class PrismJsHighlighterTest {
@ArquillianResource
private ClasspathResources classpathResources;
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @ArquillianResource
+ public TemporaryFolder tempDir;
@Test
public void should_invoke_syntax_highlighter() throws Exception {

MODIFY
build.gradle
build.gradle
@@ -65,7 +65,7 @@ ext {
jcommanderVersion = '1.72'
jrubyVersion = '9.2.17.0'
jsoupVersion = '1.12.1'
- junitVersion = '4.13.1'
+ junitVersion = '4.13.2'
assertjVersion = '3.19.0'
nettyVersion = '4.1.58.Final'
saxonVersion = '9.9.0-2'

MODIFY
docs/modules/syntax-highlighting/examples/org/asciidoctor/integrationguide/syntaxhighlighter/HighlightJsHighlighterTest.java
docs/modules/syntax-highlighting/examples/org/asciidoctor/integrationguide/syntaxhighlighter/HighlightJsHighlighterTest.java
@@ -8,7 +8,6 @@ import org.asciidoctor.SafeMode;
import org.asciidoctor.util.ClasspathResources;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
@@ -29,8 +28,8 @@ public class HighlightJsHighlighterTest {
@ArquillianResource
private ClasspathResources classpathResources;
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @ArquillianResource
+ public TemporaryFolder tempDir;
@Test
public void should_invoke_syntax_highlighter() throws Exception {

MODIFY
docs/modules/syntax-highlighting/examples/org/asciidoctor/integrationguide/syntaxhighlighter/PrismJsHighlighterTest.java
docs/modules/syntax-highlighting/examples/org/asciidoctor/integrationguide/syntaxhighlighter/PrismJsHighlighterTest.java
package org.asciidoctor.integrationguide.syntaxhighlighter;
-import org.apache.commons.io.IOUtils;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.AttributesBuilder;
import org.asciidoctor.OptionsBuilder;
@@ -11,21 +10,14 @@ import org.jboss.arquillian.test.api.ArquillianResource;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import java.io.File;
-import java.io.FileReader;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
@RunWith(Arquillian.class)
public class PrismJsHighlighterTest {
@@ -36,8 +28,8 @@ public class PrismJsHighlighterTest {
@ArquillianResource
private ClasspathResources classpathResources;
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @ArquillianResource
+ public TemporaryFolder tempDir;
@Test
public void should_invoke_syntax_highlighter() throws Exception {

Avoid use of Rules which seem to break the order of events in Arquillian