revamp createTest for better test coverage and mocking