Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Anna Kozlova
Subsystem
Unit Testing. JUnit
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Brian Duff
    2 years ago (04 Apr 2009 02:52)
  • Updated by   root
    2 years ago (17 Jan 2010 21:13)
  • Jira: IDEADEV-36002
    (history, comments)
 
IDEA-48477 JUnitPatcher can't modify classpath of test configuration
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
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
Comments (2)
 
History
 
Linked Issues (?)
 
Brian Duff
  Brian Duff
06 Apr 2009 22:34
2 years ago
The following patch fixes the issue for us (patch is for the SelenaMinor branch of junit/src/com/intellij/execution/junit/TestObject.java):

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());
Brian Duff
  Brian Duff
09 Jun 2009 01:43
2 years ago
Here's the patch for the Diana81 branch:

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());