public static synchronized < T > T createMockAndExpectNew ( Class < T > type , Object ... arguments ) throws Exception { T mock = createMock ( type ) ; expectNew ( type , arguments ) . andReturn ( mock ) ; return mock ; }
Convenience method for createMock followed by expectNew .