[Added] Test for factory pattern.