Scala Unit Testing - Mocking an implicitly wrapped function -
i have question concerning unit tests i'm trying achieve using mockito in scala. i've looked scalamock sounds feature not provided well. suppose maybe i'm looking narrow way solution , there might different perspective or approach im doing opinions welcomed.
basically, want mock function available object using implicit conversion, , don't have control change how done. since i'm user library. concrete example similar following scenario
rdd: rdd[t] = //existing rdd sqlcontext: sqlcontext = //existing sqlcontext import sqlcontext.implicits._ rdd.todf() /*todf() doesn't exist @ rdd implicitly added when importing sqlcontext.implicits._*/
now in testing, i'm mocking rdd
, sqlcontext
, want mock todf()
function. can't mock function todf()
since doesn't exist on rdd level. if simple trick, importing mocked sqlcontext.implicit._
error function not publicaly available object can't mocked. tried mock code implicitly executed until todf()
stuck final/pivate[in accessible] classes can't mock. suggestions more welcomed. in advance :)
Comments
Post a Comment