scalamock and method with multiple argument -
i trying mock object has function multiple argument.
i try set expectation it. is, somehting of form:
(item.addmetadata(,,,,,)).expects("","","","","","","")
i don't know how write it. example, deal 1 argument function: (item.addmetadata _).expects("")
how deal multiple argument ?
edit1
i change just sake of compiling:
(item.addmetadata _) expects (where { (schema: string, element: string, qualifier: string, lang: string, value: string) => true })
now problem apparently method overloaded ?
i following error:
error:(21, 15) ambiguous reference overloaded definition, both method addmetadata in class item of type (x$1: string, x$2: string, x$3: string, x$4: string, x$5: string, x$6: string, x$7: int)unit , method addmetadata in class item of type (x$1: string, x$2: string, x$3: string, x$4: string, x$5: string)unit match expected type ? (item.addmetadata _) expects (where { ^
as side not should added fact mocking class , not interface. class not under control, has private constructor , static create method. following error:
error:(18, 24) constructor item in class item cannot accessed in <$anon: org.dspace.content.item> val item = mock[item] ^
(item.addmetadata _).expects(seq("", "", "", "", "", "", ""))
see: http://scalamock.org/user-guide/advanced_topics/#example-5---repeated-parameters
Comments
Post a Comment