Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junit windows fix #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

benmss
Copy link
Collaborator

@benmss benmss commented Jun 25, 2020

On Windows, the JUnit runner fails to correctly set the classpath when using the '-cp' argument, leading to 'ClassDefNotFound' exceptions.
To fix this issue, the JUnit jar has to be run as a typical Java class, i.e. through the Java classpath.
To accomplish this, the classpath is adjusted to look like the following (Using linux separator as an example):
<junit_runner>:<original_classpath>

In addition the 'spring-mock' dependency is extracted from the original classpath, and moved to the end. Producing the following:
<junit_runner>:<classpath_without_spring-mock>:<spring-mock>

This is then run using:
java -cp <updated_classpath> <junit_runner_class> <junit_runner_args>

Note: The JUnit runner main class is assumed to be: 'org.junit.platform.console.ConsoleLauncher'

@benmss benmss requested a review from jensdietrich June 25, 2020 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant