Helper functionality for writing unit tests.