Mock configuration in tests.
Refactored tests to reduce code.