1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 6 package org.mockitousage.bugs; 7 8 import org.junit.Test; 9 import org.mockitousage.IMethods; 10 import org.mockitoutil.TestBase; 11 12 import static org.mockito.Mockito.*; 13 14 //issue 151 15 public class StubbingMocksThatAreConfiguredToReturnMocksTest extends TestBase { 16 17 @Test 18 public void shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKS() { 19 IMethods mock = mock(IMethods.class, RETURNS_MOCKS); 20 when(mock.objectReturningMethodNoArgs()).thenReturn(null); 21 } 22 23 @Test 24 public void shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKSWithDoApi() { 25 IMethods mock = mock(IMethods.class, RETURNS_MOCKS); 26 doReturn(null).when(mock).objectReturningMethodNoArgs(); 27 } 28 } 29