Simplify tests, extracting factory