Hi Mates, i need a help in writing unit test cases...
# android
r
Hi Mates, i need a help in writing unit test cases for a top level function, if possible can you guys help me to get through this, Stackoverflow question , thanks in advance
a
I've just answered your question in SO. Not sure if it will help, I hope so 🙂
👏 1
r
thanks for your time and help, i am getting the error, please have a look at the screenshot, and formatted test code on this link, https://pastebin.com/j63uEyek, Please help, and once again thanks
@Alex Barcelo
a
Sorry, my bad, I assumed the function returned a boolean indicating if the phone number was valid or not. so, if no result is returned (but a Unit), just remove the assert line
I'll edit the answer in SO
r
@Alex Barcelo Thanks for your continous help, but Now, i am getting exception, please see the image, and logcat exception is in pastebin link, https://pastebin.com/c5Npxtcb
a
Dude, it's being my bad all the time 😅
I swapped string resources ...
here, mockk complains that indeed the lambda has been invoked, but not with the expected argument
So it should be
Copy code
verify { fn.invoke(R.string.phone_validation_mobile) }
👍 1
r
@Alex Barcelo thanks once again, at least this step had further motivated me to go further for Unit Testing
💪 1