Add a test for the captureOutputBuffer method