Add const and better documentation to collectUnitTests.