Run junit test certain amount of time
问题 I want to test something for a while, say 5 seconds, and then pass the test if nothing wrong has been asserted. Is this possible with annotations? Can something like @Test(uptime=5000) be used? 回答1: Revised answer after question was edited Fundamentally it feels like you're testing the wrong thing here - it seems very odd for "nothing happening" to be a sign of success. If you want to prove that your algorithm can run for a certain amount of time without failing, I would actually extract out