score:1

the key is to understand how the anonymous function placeholder parameter syntax works. for example, given

def f(i: int*) = ???

then

f(_: int)

expands to

(i: int) => f(i)

hence try

def mockget(headers : seq[(string, string)) =
  ((xs: seq[(string, string)]) => mockwsclient.withhttpheaders(xs: _*)).expects(headers)

here is a simplified example

trait zar {
  def f(i: int*) = i
}

class scalamockvarargsspec extends flatspec with matchers with mockfactory {
  "varargs" should "be mockable" in {
    val zar = mock[zar]
    ((xs: seq[int]) => zar.f(xs: _*)).expects(seq(1,2))
    zar.f(1,2)
  }
}

in your particular case there are multiple anonymous function placeholder parameters, so try expanding them all, for example

def mockget(url: string, headers : seq[(string, string)) =
  ((u: string, xs: seq[(string, string)]) => mockwsclient.url(u).withhttpheaders(xs: _*))
    .expects(url, headers)

Related Query

More Query from same tag