• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito.verification;
6 
7 import org.junit.Rule;
8 import org.junit.Test;
9 import org.junit.rules.ExpectedException;
10 import org.mockito.Mockito;
11 import org.mockito.exceptions.misusing.FriendlyReminderException;
12 
13 public class NegativeDurationTest {
14     @Rule
15     public ExpectedException expectedException = ExpectedException.none();
16 
17     @Test
should_throw_exception_when_duration_is_negative_for_timeout_method()18     public void should_throw_exception_when_duration_is_negative_for_timeout_method() {
19         expectedException.expect(FriendlyReminderException.class);
20         expectedException.expectMessage("Don't panic! I'm just a friendly reminder!");
21         Mockito.timeout(-1);
22     }
23 
24     @Test
should_throw_exception_when_duration_is_negative_for_after_method()25     public void should_throw_exception_when_duration_is_negative_for_after_method() {
26         expectedException.expect(FriendlyReminderException.class);
27         expectedException.expectMessage("Don't panic! I'm just a friendly reminder!");
28         Mockito.after(-1);
29     }
30 }
31