code: 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;
      }
docs: Convenience method for createNiceMock 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