1 package org.mockito.verification;
2 
3 import org.junit.Assert;
4 import org.junit.Test;
5 import org.mockito.Mockito;
6 import org.mockito.exceptions.misusing.FriendlyReminderException;
7 
8 public class NegativeDurationTest {
9 
10     @Test
should_throw_exception_when_duration_is_negative_for_timeout_method()11     public void should_throw_exception_when_duration_is_negative_for_timeout_method() {
12         try {
13             Mockito.timeout(-1);
14             Assert.fail("It is forbidden to invoke Mockito.timeout() with negative value.");
15         } catch (FriendlyReminderException e) {
16             Assert.assertTrue(true);
17         }
18     }
19 
20     @Test
should_throw_exception_when_duration_is_negative_for_after_method()21     public void should_throw_exception_when_duration_is_negative_for_after_method() {
22         try {
23             Mockito.after(-1);
24             Assert.fail("It is forbidden to invoke Mockito.after() with negative value.");
25         } catch (FriendlyReminderException e) {
26             Assert.assertTrue(true);
27         }
28     }
29 }
30