Reputation: 6493
I created simple Java project in IntelliJ, one class (RandomizedQueue) and generated JUnit test class for it. So it's just two files and they both are in the same directory - src.
Everything compiled and all was well. For some time. Then suddenly - it stopped with this error:
java: cannot find symbol
symbol: class RandomizedQueue
location: class RandomizedQueueTest
I tried everything I could think of. Recreating a project worked for a while but the same error reappeared (without any obvious reason). I can't find any logic in this! Compilation from cmd does work.
I tried deleting everything from class and test - and I still can't make an instance in test method.
Upvotes: 13
Views: 14580
Reputation: 31
I had the same problem. I fixed it by rebuilding the package in which the tests were located. Right click on the package and select "rebuild 'package name'".
Upvotes: 2
Reputation: 14477
I have the same issue every once in a while in my gradle projects (I'm on IntelliJ 2018.2.4 now).
The solution is to open a terminal and execute gradlew idea
.
Upvotes: 0
Reputation: 10601
See those white x-es next to the class name?
Somehow you have excluded RandomizedQueue class from the compilation.
Remove it from the excludes and everything will be back to where it was before.
PS: Coursera FTW :-)
Upvotes: 10