Had the PPL exam yesterday. No surprise - I elegantly fried it. I haven't had such a frustrating exam in AIT since the M3 exam last sem. But there's no time to ruminate at all, for I have MIS and SP, both of which are 0% complete! :(
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.