java - How do we unit test this lambda expression? -
we have rest end point (jax-rs) invoked browser. passing around outputstream have browser display result of call.
here method.
@path("/mypath/{userid}") @post public response createuser(@pathparam("userid") final int userid ) { streamingoutput stream = (outputstream) -> { user user = userhelper.finduser(userid); userhelper.updateuser(user,outputstream); }; return response.ok(stream).build(); }
using junit , mockito, how verify if userhelper.finduser
, userhelper.updateuser
has been called ?
basically want verify interactions.
to "unit" test should create test class , create new instance of class method belongs in test class. userhelper not defined in lambda class member? if can mocked:
Comments
Post a Comment