Making test classes in sample package compatible with both user and tenant modes.

This commit contains the improvement that make test classes compatible with both user and tenant mode