Finding a Job (10 Part Series)
I started refactoring my repository to accept local and remote source contracts instead of concrete classes.
Here's an awesome tutorial on how to use Mockito for unit tests: https://www.vogella.com/tutorials/Mockito/article.html
I worked the morning on writing unit tests for my repository. I have to say, it was fun.
I used Mockito for the first time and it was a great experience. There were hiccups here and there but overall it was a nice experience.
Some of the roadblocks I faced:
Booleanvalues. Turns out there was an issue with Mockito v2.8.9 while unboxing/autoboxing
Booleanvalues on Kotlin. Solved it by upgrading to v3.0.0.
Nullablevalue and my parameters were non-nullable. I had to fix this by introducing a local alternate method like this:
fun <T : Any> safeArgumentEq(value: T): T = eq(value) ?: value
My repository is now well-tested. You can find the test file for reference, on GitHub.