On the generalization of Forelli’s theorem