I have written a small piece of test code and am compiling it with IntelliJ IDEA 12 CE
import com.twitter.common.zookeeper.ZooKeeperClient
import org.mockito.Mockito
class MyResourceSpec {
val zkClient = mock(classOf[ZooKeeperClient])
...
}
I get the following error:
not found: value classOf
val zkClient = mock(classOf[ZooKeeperClient])
^
However I am able to build the project successfully using mvn compile. Also, I have another test file in the same directory "MyOtherResourceSpec.scala" which contains the exact same lines of code.
Any thoughts on why this doesn't build correctly in IDEA?
Things I've tried:
A coworker suggested that IDEA might not recognize it as a scala file, and I've tried clicking on the top-level project and then clicking Maven > reimport.
Restarting IntelliJ
Copying all imports from "MyOtherResourceSpec.scala" in case something was missing
using Mockito.mock(classOf[ZooKeeperClient])
Okay, I solved this by clicking File > Invalidate Caches and restarting IntelliJ. Then I did not need to import Predef.classOf.
I also had to remove the following import statement:
import scala.Predef.String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With