I want to test my application, written in Java (without Spring), which consumes data from external source via kafka and does some operations on them. I am simulating the messages incoming (sending the data via kafka) but the problem is that when my system consumes the data, it is asking external service for some more details related to the data (via API) to do the operations. The problem is that I want to manipulate the data and check how my system process this data basing on different external API responses.
See the picture describing how it looks like.
Please remember that I am doing the tests outside the code implementation (actually automation testing). I want to simulate different messages incoming (which are changing a data also in the external database which external API uses) and check how my system works.
What is the best approach to somehow 'mock' the external API which my system uses? Should I implement whole external API/database and set my system to use other API url (pointing to the fake service) or is there any easier way? Are there some good tools for that?