Trying to understand IDEA Scala error

In IDEA 2017.1.2, I have the following failure:

When using ScalaMock, given, in part, from
public interface Config extends ConfigMergeable {
String getString(String path);

and in part, from
public interface Connection extends ShutdownNotifier, Closeable {
Channel createChannel() throws IOException;

That this compiles:
class MySpec extends FlatSpec with Matchers with MockFactory {
private val mockConfig = mock[Config]
(mockConfig.getString _).expects("myhost").returning("test_host").anyNumberOfTimes

But this errs with 'Cannot resolve symbol createChannel'?
class MySpec extends FlatSpec with Matchers with MockFactory {
private val mockChannel = mock[Channel]
private val mockConnection = mock[Connection]
(mockConnection.createChannel _).expects().returning(mockChannel).anyNumberOfTimes

Everything seems the same to me, so perhaps I'm just missing something.


Is this in an sbt project? Does it compile with sbt? Are you able to share an example project with this problem?



It's sbt, yes. The weird thing in sbt is that the code provided compiles under sbt, but fails when it runs:

scala.MatchError: Failure(org.scalatest.exceptions.TestFailedException: Unexpected call: <mock-3> Connection.createChannel()

so, it doesn't complain at compile time, but the method mock doesn't get registered, either.

As far as an example is concerned, there's working code and failing code provided with the original question. What's missing that you would like to see? I can't share the whole project.


The issue sounds like it might be a problem with the import in IDEA, or something related to dependencies or indexes. Just from the code snippets I won't be able to reproduce the failure and figure out what causes it or how to fix it.

So I can only give you some general hints to try:

  • reimport/refresh the project
  • try File / Invalidate Caches and Restart

Okay, tried those with no success. I'll create a new project to try reproducing the error.


Justin, thanks for your patience. Have a look at


I see that message is still pending approval, presumably a result of the URL. The project is on github, at DonBranson/scala_debug.


Please sign in to leave a comment.