-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce lambda based timeout assertions #438
Comments
sbrannen
changed the title
Introduce lamba based timeout assertions
Introduce lambda based timeout assertions
Jul 26, 2016
sbrannen
added a commit
that referenced
this issue
Jul 26, 2016
This commit introduces assertTimeout() methods in Assertions that support both lazy and preemptive timeouts for blocks of code supplied as lambda expressions. For example, the following assertion would pass: assertTimeout(ofMillis(500), () -> Thread.sleep(10)); Whereas, the following assertion would fail: assertTimeout(ofMillis(10), () -> Thread.sleep(500)); The above examples execute the code block in the same thread as the caller. To perform the same assertions and have the code executed in a separate thread and then preemptively aborted, the above can be rewritten as follows. assertTimeoutPreemptively(ofMillis(10), () -> Thread.sleep(500)); Issue: #438
sbrannen
added a commit
that referenced
this issue
Jul 27, 2016
This commit introduces assertTimeout() methods in Assertions that support both lazy and preemptive timeouts for blocks of code supplied as lambda expressions. For example, the following assertion would pass: assertTimeout(ofMillis(500), () -> Thread.sleep(10)); Whereas, the following assertion would fail: assertTimeout(ofMillis(10), () -> Thread.sleep(500)); The above examples execute the code block in the same thread as the caller. To perform the same assertions and have the code executed in a separate thread and then preemptively aborted, the above can be rewritten as follows. assertTimeoutPreemptively(ofMillis(10), () -> Thread.sleep(500)); Issue: #438
sbrannen
added a commit
that referenced
this issue
Jul 27, 2016
This commit introduces assertTimeout() methods in Assertions that support both lazy and preemptive timeouts for blocks of code supplied as lambda expressions. For example, the following assertion would pass: assertTimeout(ofMillis(500), () -> Thread.sleep(10)); Whereas, the following assertion would fail: assertTimeout(ofMillis(10), () -> Thread.sleep(500)); The above examples execute the code block in the same thread as the caller. To perform the same assertions and have the code executed in a separate thread and then preemptively aborted, the above can be rewritten as follows. assertTimeoutPreemptively(ofMillis(10), () -> Thread.sleep(500)); Issue: #438
Merged into |
sbrannen
added a commit
that referenced
this issue
Jul 27, 2016
sbrannen
added a commit
that referenced
this issue
Jul 27, 2016
sbrannen
added a commit
that referenced
this issue
Jul 27, 2016
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Status Quo
Assertions
providesassertThrows
andexpectThrows
for expected exceptions but does not provide support for asserting timeouts.Deliverables
Assertions
.The text was updated successfully, but these errors were encountered: