added tests for factory method pattern