I encountered a tricky problem today, I was writing a test for which the assertion was onto some function called or not. I couldn’t mock that function as it was part of an external API for which I couldn’t change the real Object to a mocked Object. There was a solution, checking that this function was logging a particular event or not. So in order to assert that this specific line was logged or no