Refactored to make it easier to re-use the test configuration.