This example shows how to limit the execution time on a junit test. It uses the timeout parameter on @Test by passing in the max number of milliseconds a test has to run. This is helpful if you mix integration tests or have long running tests. When the time limit is exceeded, a failure is triggered by an Exception being thrown.