Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

java - Why does Intellij IDEA suddenly not recognize tests in test folder anymore?

I'm using JUnit since I started this project and everything works just fine. I have a couple of hundreds tests, and of course, here and there I start them all. Right click on root test folder, run (or debug) with JUnit. But since yesterday, when I do that, the result is:

Process finished with exit code 0

without starting any of tests. Same thing is with any folder in folder tree. I can still run a single test class, but I really need an option to start them all. If any of you have any ideas, please drop them here.

Here is what is logged when I try to run tests:

2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - IntelliJ IDEA 11.1.2  Build #IU-117.418 
2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - JDK: 1.6.0_31 
2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - VM: Java HotSpot(TM) Client VM 
2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - Vendor: Sun Microsystems Inc. 
2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - OS: Windows 7 
2012-10-31 15:16:55,693 [2727217]  ERROR - ij.psi.impl.source.PsiFileImpl - Last Action: RunClass 
2012-10-31 15:16:55,693 [2727217]  ERROR - m.intellij.util.ExecutorsQuery - com.intellij.psi.tree.IFileElementType cannot be cast to com.intellij.psi.tree.IStubFileElementType 
java.lang.ClassCastException: com.intellij.psi.tree.IFileElementType cannot be cast to com.intellij.psi.tree.IStubFileElementType
    at com.intellij.psi.impl.source.PsiFileImpl.calcStubTree(PsiFileImpl.java:976)
    at com.intellij.psi.stubs.StubIndexImpl$1.perform(StubIndexImpl.java:239)
    at com.intellij.psi.stubs.StubIndexImpl$1.perform(StubIndexImpl.java:220)
    at com.intellij.util.indexing.ValueContainer.forEach(ValueContainer.java:60)
    at com.intellij.psi.stubs.StubIndexImpl.process(StubIndexImpl.java:220)
    at com.intellij.psi.stubs.StubIndexImpl.get(StubIndexImpl.java:194)
    at com.intellij.psi.stubs.AbstractStubIndex.get(AbstractStubIndex.java:33)
    at com.intellij.psi.impl.java.stubs.index.JavaAnnotationIndex.get(JavaAnnotationIndex.java:47)
    at com.intellij.psi.impl.search.AnnotatedElementsSearcher.a(AnnotatedElementsSearcher.java:93)
    at com.intellij.psi.impl.search.AnnotatedElementsSearcher.execute(AnnotatedElementsSearcher.java:44)
    at com.intellij.psi.impl.search.AnnotatedElementsSearcher.execute(AnnotatedElementsSearcher.java:28)
    at com.intellij.util.ExecutorsQuery.processResults(ExecutorsQuery.java:42)
    at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:67)
    at com.intellij.util.InstanceofQuery.forEach(InstanceofQuery.java:54)
    at com.intellij.execution.ConfigurationUtil.addAnnotatedMethodsAnSubclasses(ConfigurationUtil.java:97)
    at com.intellij.execution.ConfigurationUtil.findAllTestClasses(ConfigurationUtil.java:77)
    at com.intellij.execution.junit.TestPackage$MySearchForTestsTask.run(TestPackage.java:397)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:378)
    at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
question from:https://stackoverflow.com/questions/13157815/why-does-intellij-idea-suddenly-not-recognize-tests-in-test-folder-anymore

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

OK, I fixed it.

In menu, under File, there is an invalidate cache option. That fixed it!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...