add unit test for simple factory pattern