Made testIntegrity() more robust