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

Could not execute tests with JUnit 4.12 in IntelliJ Idea #960

Closed
stefanbirkner opened this issue Jul 22, 2014 · 2 comments
Closed

Could not execute tests with JUnit 4.12 in IntelliJ Idea #960

stefanbirkner opened this issue Jul 22, 2014 · 2 comments
Labels
Milestone

Comments

@stefanbirkner
Copy link
Contributor

When I execute a test I get the following error:

Internal Error occured.
java.lang.NoSuchFieldException: fTestClass
at java.lang.Class.getDeclaredField(Class.java:2057)
at com.intellij.junit4.JUnit4IdeaTestRunner.getSuiteMethodDescription(JUnit4IdeaTestRunner.java:128)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:45)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

This problem has been introduced by df00d5e. The field name has changed from fTestClass to testClass. Although this field is private, IntelliJ reads it by reflection within the JUnit4IdeaTestRunner. There is already an issue at JetBrains: IDEA-127349

@stefanbirkner stefanbirkner added this to the 4.12 milestone Jul 22, 2014
stefanbirkner added a commit to stefanbirkner/junit that referenced this issue Jul 24, 2014
The prefix has been removed by df00d5e,
because we changed the coding style. Unfortunately IntelliJ IDEA reads
ClassRequest.fTestClass and FilterRequest.fFilter via reflection. (See
http://grepcode.com/file/repository.grepcode.com/java/ext/com.jetbrains/intellij-idea/13.0.0/com/intellij/junit4/JUnit4IdeaTestRunner.java/ ) This makes it impossible to
start tests by using IntelliJ IDEA.

There is already an issue at JetBrains:
[IDEA-127349 ](http://youtrack.jetbrains.com/issue/IDEA-127349) We can
revert the fix when this ticket is solved and most users are using an
IntelliJ version with the fix.
stefanbirkner added a commit to stefanbirkner/junit that referenced this issue Jul 24, 2014
The prefix has been removed by df00d5e,
because we changed the coding style. Unfortunately IntelliJ IDEA reads
ClassRequest.fTestClass and FilterRequest.fFilter via reflection. (See
http://grepcode.com/file/repository.grepcode.com/java/ext/com.jetbrains/intellij-idea/13.0.0/com/intellij/junit4/JUnit4IdeaTestRunner.java/ ) This makes it impossible to
start tests by using IntelliJ IDEA.

There is already an issue at JetBrains:
[IDEA-127349 ](http://youtrack.jetbrains.com/issue/IDEA-127349) We can
revert the fix when this ticket is solved and most users are using an
IntelliJ version with the fix.
@stefanbirkner
Copy link
Contributor Author

I created pull request #961 to fix this issue. Nevertheless I try to get in contact with IntelliJ in order to find a solution that enables us to change the field names without breaking JUnit for IntelliJ users.

kcooney added a commit that referenced this issue Jul 24, 2014
Restore field names with f prefix. Fixes #960.
@kcooney
Copy link
Member

kcooney commented Jul 24, 2014

Thanks!

We might want to add a getter method for fFilter in FiltetedRequest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants