Eclipse is giving me the following error:
ambiguous reference to overloaded definition, both method exec in trait Execs of type (scenario: io.gatling.core.structure.ScenarioBuilder)io.gatling.core.structure.ChainBuilder and method exec in trait Execs of type (chains: Iterable[io.gatling.core.structure.ChainBuilder])io.gatling.core.structure.ChainBuilder match argument types (com.cigna.common.RestfulService)
Here is part of the definition of RestfulService:
`
object RestfulService {
implicit def toRequest[T <: StructureBuilder[T]]( x: RestfulService ) : T = x.apply
}
trait RestfulService {
protected var formParams: Map[String,Any] = Map()
protected def formParameter( key: String, value: Any ) = {
formParams += ( key → value )
this
}
protected var queryParams: Map[String,Any] = Map()
protected def queryParameter( key: String, value: Any ) = {
queryParams += ( key → value )
this
}
protected var requestHeaders: Map[String,String] = Map()
protected def header( key: String, value: String ) = {
requestHeaders += ( key → value )
this
}
def apply[T <: StructureBuilder[T]] : T
}
class RestfulGET(
description: String,
url: String
) extends RestfulService {
def apply =
http( description )
.get( url )
.header( HttpHeaderNames.Accept, HttpHeaderValues.ApplicationJson )
.headers( requestHeaders )
.queryParamMap( queryParams )
}
`
The point is to be able to write code like this:
`
val foo = exec( SomeService.get.withPreferences )
`
where that is a sub-class of RestfulService that adds the withPreferences convenience method which adds a particular query parameter.
But because I made the implicit apply method convert to a sub-type of StructureBuilder[T], both possible versions of exec() apply, so eclipse complains. Am I doing something wrong? Is there a way around this?