-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform testing using module-path (#143)
* Upgrade testing * Test as classpath-only, module-classpath and module-whitebox * Use Maven workarounds to achieve module-whitebox * Tested on Maven 3.8.8 and 3.9.9
- Loading branch information
1 parent
9807e37
commit 1ea4ef3
Showing
5 changed files
with
210 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ | |
/nbproject/ | ||
.idea | ||
*.iml | ||
/test-output/ | ||
/test-output/ | ||
/src/test/java/module-info.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2009-present, Stephen Colebourne | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
|
||
/** | ||
* Joda-Money test module. | ||
*/ | ||
open module org.joda.money { | ||
|
||
// mandatory for testing | ||
requires org.joda.convert; | ||
|
||
// all packages are exported | ||
exports org.joda.money; | ||
exports org.joda.money.format; | ||
|
||
requires transitive org.junit.jupiter.api; | ||
requires transitive org.junit.jupiter.engine; | ||
requires transitive org.junit.jupiter.params; | ||
requires transitive org.assertj.core; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2009-present, Stephen Colebourne | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
package org.joda.money; | ||
|
||
import static java.util.stream.Collectors.joining; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test that the classpath/modulepath is correctly set. | ||
*/ | ||
class TestModulepath { | ||
|
||
@Test | ||
void dumpPaths() { | ||
var classpath = System.getProperty("java.class.path", ""); | ||
var modulepath = System.getProperty("jdk.module.path", ""); | ||
System.out.println("Classpath: " + describePath(classpath)); | ||
System.out.println("Modulepath: " + describePath(modulepath)); | ||
} | ||
|
||
private static String describePath(String path) { | ||
if (path.isEmpty()) { | ||
return "<empty>"; | ||
} | ||
var list = new ArrayList<String>(); | ||
if (path.contains("target/classes") || path.contains("target\\classes")) { | ||
list.add("target/classes"); | ||
} | ||
if (path.contains("target/test-classes") || path.contains("target\\test-classes")) { | ||
list.add("target/test-classes"); | ||
} | ||
if (path.contains("joda-convert")) { | ||
list.add("joda-convert"); | ||
} | ||
if (path.contains("junit-jupiter")) { | ||
list.add("junit-jupiter"); | ||
} | ||
return list.isEmpty() ? path : list.stream().collect(joining(" ")); | ||
} | ||
} |