JUnit 5 and Java 9 compatibility

Since M5, all JUnit 5 artifacts are shipped with compiled module descriptors for Java 9, declared in its JAR manifest (file MANIFEST.MF). For example, the content of the manifest for the artifact junit-jupiter-api M6 is the following:

Manifest-Version: 1.0
Implementation-Title: junit-jupiter-api
Automatic-Module-Name: org.junit.jupiter.api
Build-Date: 2017-07-18
Implementation-Version: 5.0.0-M6
Built-By: JUnit Team
Specification-Vendor: junit.org
Specification-Title: junit-jupiter-api
Implementation-Vendor: junit.org
Build-Revision: 3e6482ab8b0dc5376a4ca4bb42bef1eb454b6f1b
Build-Time: 21:26:15.224+0200
Created-By: 1.8.0_131 (Oracle Corporation 25.131-b11)
Specification-Version: 5.0.0

With regards to Java 9, the interesting thing is the declaration Automatic-Module-Name. This allows to test modules to require the JUnit 5 module simply by adding the following lines to its module descriptor file (module-info.java):

module foo.bar {
requires org.junit.jupiter.api;
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.117.212