code: public static synchronized <T> T createMockAndExpectNew(Class<T> type, Object... arguments) throws Exception {
          T mock = createMock(type);
          expectNew(type, arguments).andReturn(mock);
          return mock;
      }
docs: Convenience method for createMock followed by expectNew.
  
  @param type      The class that should be mocked.
  @param arguments The constructor arguments.
  @return A mock object of the same type as the mock.
  @throws Exception