12637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin/* 22637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin * Copyright (c) 2007 Mockito contributors 32637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin * This program is made available under the terms of the MIT License. 42637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin */ 52637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 62637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinpackage org.mockitousage.bugs; 72637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 82637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinimport org.junit.Test; 92637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinimport org.mockitousage.IMethods; 102637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinimport org.mockitoutil.TestBase; 112637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 122637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinimport static org.mockito.Mockito.*; 132637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 142637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin//issue 151 152637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffinpublic class StubbingMocksThatAreConfiguredToReturnMocksTest extends TestBase { 162637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 172637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin @Test 182637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin public void shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKS() { 192637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin IMethods mock = mock(IMethods.class, RETURNS_MOCKS); 202637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin when(mock.objectReturningMethodNoArgs()).thenReturn(null); 212637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin } 222637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin 232637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin @Test 242637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin public void shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKSWithDoApi() { 252637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin IMethods mock = mock(IMethods.class, RETURNS_MOCKS); 262637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin doReturn(null).when(mock).objectReturningMethodNoArgs(); 272637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin } 282637d96c202372854a7c71466ddcc6e90fc4fc53Paul Duffin} 29