This should be factored out into a separate utility file. It really has nothing to do with ListTests - but tests more generally.