These days I hardly get any time for anything i want to do, blogging being one of them. So I am starting this new series. The 15 minutes of life, wherein I will be spending a good 15 minutes to update the best things that happened to me in the day. This way, I will buy some more time to think on larger posts without compromising on my presence here. Moreover, thinking about the best things that happen, give a sweet end to the day.
A recent fan of TDD, I set out to write tests for whatever comes my way. And there was one feature where the code would print messages to the console. Now - I had tests written for the API but I could not get my head around ways to capture these messages in my unittests. After some searching and some stroke of genius, here's how I accomplished capturing stdout.