asciidoctor / asciidoctorj

:coffee: Java bindings for Asciidoctor. Asciidoctor on the JVM!
http://asciidoctor.org
Apache License 2.0
625 stars 173 forks source link

Replace JUnit4 by JUnit5 #1192

Closed abelsromero closed 1 year ago

abelsromero commented 1 year ago

Kind of change

Description

What is the goal of this pull request?

Complete #1186. JUnit5 is the default now (only used in 'asciidoctorj-wildfly-integration-test' because of Arquillian). And we have a new JUnit5 tools. The Arquillian extension is left untouched.

How does it achieve that?

Replace Junit4 by Junit5

* Implement new Junit5 extensions:
   @AsciidoctorInstance & @ClasspathResource annotations
   available to inject Asciidoctor instances and resources into tests.
* Update all modules to use JUnit5 and the new extensions
  'asciidoctorj-wildfly-integration-test' remains on JUnit4 for
  Arquillian compatibility.
Other changes:
* Remove some uses of deprecated APIs
* Fix typo in sample doc
* Replace use of IOUtils.readFull(File) by Files.readString(Path)
  where possible to remove third-party dependencies.

Are there any alternative ways to implement this?

Not on the base implementation, but the naming of the JUnit5 extensions annotations is open for debate :sweat_smile: (naming is hard).

Are there any implications of this pull request? Anything a user must know?

No.

Issue

This completely closes the issue :tada:

Fixes #1186

Release notes

Please add a corresponding entry to the file CHANGELOG.adoc

Already added.

abelsromero commented 1 year ago

I just realized we publish the asciidoctorj-test-support artifact. Right now I have a JUnit5 extension that offers:

With that, we cover our needs, but maybe the ClassResource and TestMethodResource nomenclature is not very clear for users. Any suggestion, I was thinking calling it @AsciidoctorInstance with a property that accepts an enum to be shared or not :thinking:

abelsromero commented 1 year ago

Made some more progress :tada: the arquillian extension is not used but we can keep it, and only the wildfly-integration-test module uses junit 4 now.

I am also thinking renaming asciidoctorj-test-support to asciidoctorj-junit-extenasion, that would make it's intent clear, and that way it can awaken interest from users.

abelsromero commented 1 year ago

Ready :tada:

robertpanzer commented 1 year ago

Thank you for this! This is awesome! 🙌