when()and 5 related methods are used to define functions (if not defined yet) and:
usestatement is in place:
when()in combination with
justReturn()you can make a (maybe) undefined function just return a given value:
justReturn()the target function will return nothing (
when-related method is used to make the target function return one of the received arguments, by default the first.
returnArg()throws an exception:
justReturn(), it makes the mocked function echo some value instead of returning it.
returnArg(), it makes the mocked function echo some received argument instead of returning it.