Capture and check collector's stdout and stderr during tests

Change-Id: I125afbaf386664f34c6db2b1628f3f5008790aca