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)
Source: stackoverflow.com
Related Query
- Scalamock : How to specify arbitrary sequence of tuples
- How to specify return type for nested arrays of arbitrary nesting length?
- How to convert a sequence of Tuples into JSON array in spray
- Scala: how to transform sequence of strings into a sequence of tuples by splitting strings
- How to split a sequence into two pieces by predicate?
- How to specify JVM maximum heap size "-Xmx" for running an application with "run" action in SBT?
- Scala: how can I sort an array of tuples by their second element?
- How to build a multimap from a list of tuples in Scala?
- How to carry on executing Future sequence despite failure?
- How to alias a sequence of tasks?
- How to flatten a sequence of cats' ValidatedNel values
- How can I handle a > 22 column table with Slick using nested tuples or HLists?
- How to specify schema for CSV file without using Scala case class?
- How to sum a list of tuples
- How to specify that to build project A another project B has to be built first?
- How do I specify a static array in a Scala 2.8 annotation?
- How to get ScalaCheck's Arbitrary to always generate some special case values?
- How to specify SLICK Query sortBy column from runtime parameter?
- How should I specify the type of JSON-like unstructured data in Scala?
- How to specify complex form validations in Play 2?
- How do i specify spray Content-Type response header?
- How to implement lazy sequence (iterable) in scala?
- How to merge tuples by same elements in Scala
- How to fold a Scala iterator and get a lazily evaluated sequence as result?
- How to initialize an Either to Right and specify the type of Left?
- How to group a variable-length, repeating sequence in Scala
- How to specify different application.conf for specs2 tests?
- How do I specify the order of plugins (bound to the same phase) in Maven 3?
- How to concisely check if tuples have no overlappping members
- How can I apply an HList of arbitrary functions to an arbitrary value?
More Query from same tag
- Recursively transform elements in shapeless records based on type
- Finding lines that start with a digit in Scala using filter() method
- Execute command block in primitive in NetLogo extension
- Scala package objects and Play! 2
- Akka Actor Searching and Streaming Events
- Scala Generic: The return data type of a method with lower bound type
- Returning subclass of parameterized type in Scala
- Returning a new Dataframe (by transforming an existing one) using a function - spark/scala
- How to pass a variable to an Action from an intercepted request in PlayFramework?
- MS SQL JDBC error on Execution exception - Invalid object name [Play 2.x scala app]
- costly computation occuring in both isDefined and Apply of a PartialFunction
- Get max term and number
- Retrieve object method
- How to bind/pass varibles in Spark dataframe
- What is the difference between using the return statement and defaulting to return the last value?
- I can't get my scalaFX menubar to show up in my gui
- How to parse two different types in one parser in Scala?
- Kafka/Flink integration problems with map function
- Simple composition of functions in Scala
- Is map of Future lazy or not?
- Collector in Flink. What does it do?
- Scala: Why are Actors lightweight?
- Scala/ Spark- Multiply an Integer with each value in a Dataframe Column
- sbt ignore test failures
- Size Parameterization in Scala
- Scala: From string to tuple
- Spark Scala [for loop embedded with if-else] how can I not receive duplicate array
- Intellij - Run scala main file
- Scala simple funsuite unit test with akka actors fails
- What is ClassManifest in Scala?