changed unit tests to use factory