Mr. Rushdie, an author, testified about the 2022 stabbing in upstate New York, where he was speaking at a literary festival.