Extract factory to parameters and refactor test.