• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockitousage.stubbing;
6 
7 import static org.assertj.core.api.Assertions.assertThatThrownBy;
8 import static org.mockito.Mockito.doReturn;
9 import static org.mockito.Mockito.validateMockitoUsage;
10 
11 import org.junit.Test;
12 import org.mockitoutil.TestBase;
13 
14 public class MisusingStubbingTest extends TestBase {
15 
16     @Test
clean_state_after_not_a_mock()17     public void clean_state_after_not_a_mock() {
18         // when
19         assertThatThrownBy(() -> doReturn(100).when("not a mock"));
20 
21         // then
22         validateMockitoUsage();
23     }
24 
25     @Test
clean_state_after_null_passed()26     public void clean_state_after_null_passed() {
27         // when
28         assertThatThrownBy(() -> doReturn(100).when(null));
29 
30         // then
31         validateMockitoUsage();
32     }
33 }
34