{"id":19968168,"url":"https://github.com/sormuras/junit5-class-vs-module-path","last_synced_at":"2026-06-10T17:31:35.634Z","repository":{"id":85458848,"uuid":"186931128","full_name":"sormuras/junit5-class-vs-module-path","owner":"sormuras","description":"Same tests, different run modes","archived":false,"fork":false,"pushed_at":"2019-05-16T14:18:34.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-28T07:17:07.222Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sormuras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-16T01:52:19.000Z","updated_at":"2019-05-16T14:18:36.000Z","dependencies_parsed_at":"2023-03-03T08:30:45.207Z","dependency_job_id":null,"html_url":"https://github.com/sormuras/junit5-class-vs-module-path","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sormuras/junit5-class-vs-module-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormuras%2Fjunit5-class-vs-module-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormuras%2Fjunit5-class-vs-module-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormuras%2Fjunit5-class-vs-module-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormuras%2Fjunit5-class-vs-module-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sormuras","download_url":"https://codeload.github.com/sormuras/junit5-class-vs-module-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormuras%2Fjunit5-class-vs-module-path/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34163253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T02:44:46.643Z","updated_at":"2026-06-10T17:31:35.615Z","avatar_url":"https://github.com/sormuras.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/sormuras/junit5-class-vs-module-path.svg?branch=master)](https://travis-ci.com/sormuras/junit5-class-vs-module-path)\n\n# junit5-class-vs-module-path\nSame [tests](src/test/check/check/CheckTests.java), same binaries, different run modes.\n\n```java\nclass CheckTests {\n  @org.junit.jupiter.api.Test\n  @org.junit.jupiter.api.condition.EnabledIf({\n    \"print('\u003e\u003e')\",\n    \"print(systemProperty)\",\n    \"print(systemProperty.get)\",\n    // \"print(systemProperty.get('java.version'))\", // only works on the `--class-path`\n    \"print('\u003c\u003c')\",\n    \"true\"\n  })\n  void test() {}\n\n  @org.junit.jupiter.api.Test\n  void emitStringRepresentationOfTestModule() {\n    org.junit.jupiter.api.Assumptions.assumeTrue(false, getClass().getModule().toString());\n  }\n}\n```\n\n## `--module-path` and `module check`\n\n```text\n\u003e\u003e\norg.junit.jupiter.engine.script.ScriptAccessor$SystemPropertyAccessor@4716be8b\nundefined\n\u003c\u003c\n```\n\n\n## `--class-path` and `unnamed module @14f9390f`\n\n```text\n\u003e\u003e\norg.junit.jupiter.engine.script.ScriptAccessor$SystemPropertyAccessor@275bf9b3\n[jdk.dynalink.beans.SimpleDynamicMethod String org.junit.jupiter.engine.script.ScriptAccessor.SystemPropertyAccessor.get(String)]\n\u003c\u003c\n```\n\n## Analysis\n\nAt [ScriptExecutionManager.java#L85-L87](https://github.com/junit-team/junit5/blob/master/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/script/ScriptExecutionManager.java#L85-L87)\nthe referenced `systemProperty` variable is bound.\n\nWhy is `SimpleDynamicMethod` applied only when running on the class path?\n\n### Underlying Exception\n\n```text\n     Caused by: javax.script.ScriptException: TypeError: systemProperty.get is not a function in \u003ceval\u003e at line number 3\n       jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:477)\n       jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:433)\n       jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine$3.eval(NashornScriptEngine.java:521)\n       java.scripting/javax.script.CompiledScript.eval(CompiledScript.java:89)\n       org.junit.jupiter.engine@5.5.0-SNAPSHOT/org.junit.jupiter.engine.script.ScriptExecutionManager.evaluate(ScriptExecutionManager.java:72)\n       [...]\n     Caused by: \u003ceval\u003e:3 TypeError: systemProperty.get is not a function\n       jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)\n       jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)\n       jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)\n       jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)\n       jdk.scripting.nashorn/jdk.nashorn.internal.runtime.Undefined.lookup(Undefined.java:100)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsormuras%2Fjunit5-class-vs-module-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsormuras%2Fjunit5-class-vs-module-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsormuras%2Fjunit5-class-vs-module-path/lists"}