Templatized collector() and extracted to its own header, since both
STest and DTest will use it.