Test util

### Motivation
An exercise in using mock objects for test isolation.

### Changelog
* Unit test most of the `util` module.