Mocking methods with return type void

Reading Time: 1 minute For a long while I’ve been looking forward to mocking void methods, I always thought that would be fairly impossible. After a long search online I’ve found it how to do it. So this example is from my work, it is a simple dummy method which creates a user on a 3rd party system. import

JUnit exception testing

Reading Time: 1 minute Now a days while I discover TDD and testing in software development, I’ve come to realize that it is also possible to test exceptions in Junit as well. I’ve noticed this while I was checking a code snippet of a software online and right after that I’ve tested the same thing to see the outcome.

How do I test File api in Junit

Reading Time: 1 minute I was looking for a way to test Java file apis, especially I’ve such methods which return Java File. I somehow felt that those methods also have to be tested at least a small test case could be conducted. I did check what File api returns at Oracle Api Docs. The Method you’ll observe below