Unit test for class Factory