Skip to content
Advertisement

Testing method called with specific string

I am trying to find answer to my question but unable to find something working. I have a class which does this

JavaScript

and my test is

JavaScript

How would I test that calling llw.logInfo actually calls lambdaLogger.log with the appropriate string?

Advertisement

Answer

Invoke the logInfo() method on the instance under test :

JavaScript

And use the Mockito#verify() method to assert that the mock was invoked with the expected method and with the parameter you have passed to the tested method :

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement