At Google, we're using the com.intellij.execution.JUnitPatcher API to override certain aspects of the java parameters used for running tests. We'd like to be able to use this to also alter the classpath we use for running tests, since our runtime classpath is different from our compiletime classpath.
The JUnitPatchers are called by com.intellij.execution.junit.TestObject.initialize() after setting up the main class and the JDK of the JavaParameters. However, subclasses of TestObject are responsible for populating the classpath, and unfortunately do this after JunitPatcher.patchJavaParmeters has already been called. We'd like for JUnitPatcher.patchJavaParameters() to be called as late as possible so that we can override anything.
Environment: Linux
Issue was resolved
181,184c181
< final Object[] patchers = Extensions.getExtensions(ExtensionPoints.JUNIT_PATCHER);
< for (Object patcher : patchers) {
< ((JUnitPatcher)patcher).patchJavaParameters(module, myJavaParameters);
< }
---
>
201a199,205
> private void patchJavaParameters(Module module) {
> final Object[] patchers = Extensions.getExtensions(ExtensionPoints.JUNIT_PATCHER);
> for (Object patcher : patchers) {
> ((JUnitPatcher)patcher).patchJavaParameters(module, myJavaParameters);
> }
> }
>
205a210
> patchJavaParameters(myConfiguration.getConfigurationModule().getModule());
182,185d181
< final Object[] patchers = Extensions.getExtensions(ExtensionPoints.JUNIT_PATCHER);
< for (Object patcher : patchers) {
< ((JUnitPatcher)patcher).patchJavaParameters(module, myJavaParameters);
< }
194a191,197
> private void patchJavaParameters(Module module) {
> final Object[] patchers = Extensions.getExtensions(ExtensionPoints.JUNIT_PATCHER);
> for (Object patcher : patchers) {
> ((JUnitPatcher)patcher).patchJavaParameters(module, myJavaParameters);
> }
> }
>
198a202
> patchJavaParameters(myConfiguration.getConfigurationModule().getModule());