Skip to content

Junit windows fix#6

Open
benmss wants to merge 3 commits into
jensdietrich:masterfrom
benmss:junit-windows-fix
Open

Junit windows fix#6
benmss wants to merge 3 commits into
jensdietrich:masterfrom
benmss:junit-windows-fix

Conversation

@benmss

@benmss benmss commented Jun 25, 2020

Copy link
Copy Markdown
Collaborator

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