Refactored testCollision method.