Creating a dummy implementation of the method

To be able to write a unit test, we need to write a method that follows the method signature requirements (input and output), but we will just let it return null. By doing this, we can write a unit test, see it fail, and then provide the correct implementation and see the test succeed.

If you study the business rules closely, you'll find that you have to write a method that would take an input and generate a response. The method has to be self-contained; it does not seem to require any class instance variables or methods. We, therefore, will choose to write a static class method. During the coding of the unit test, we can determine whether this was a bad choice. If so, we can always change it ...

Get Introduction to JVM Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.