public static synchronized < T > T createNiceMockAndExpectNew ( Class < T > type , Object ... arguments ) throws Exception { T mock = createNiceMock ( type ) ; IExpectationSetters < T > expectationSetters = expectNiceNew ( type , arguments ) ; if ( expectationSetters != null ) { expectationSetters . andReturn ( mock ) ; } return mock ; }
Convenience method for createNiceMock followed by expectNew .