Michael Vandendriessche
03/02/2022, 3:26 PMSomeClass
. Do I have to return SomeClass()
or is there something else available like return any or return whatever?Mattia Tommasone
03/02/2022, 3:29 PMMichael Vandendriessche
03/02/2022, 3:34 PMbatteryImage.setImageDrawable(context.getResources().getDrawable(R.drawable.battery_100));
I'm mocking getDrawable
, I don't care what it returns I just want to verify it was called with R.drawable.battery_100. And I do not want to execute the getresources and getdrawable.
I know it's not ideal code to unit test but it's what I have right now. Fixing these thingsi s on the planning for later.
Thanks for your reply!christophsturm
03/02/2022, 3:40 PMjustRun
or use a relaxed mock.Michael Vandendriessche
03/02/2022, 3:48 PMevery
? Sorry I forgot about that one, I was trying just Runs
as return value. Thanks!christophsturm
03/02/2022, 3:49 PMMichael Vandendriessche
03/02/2022, 3:49 PMjust
only works on UnitMichael Vandendriessche
03/02/2022, 3:52 PMMattia Tommasone
03/02/2022, 3:53 PMjust runs
can only be used on methods returning Unit.
i’d say your best option is to use a relaxed mockMichael Vandendriessche
03/02/2022, 4:09 PM