Factor out common test stuff into a trait and clean up all test files.
Do a scalariform pass