org.easymock.EasyMock.createNiceControl()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.easymock.EasyMock.createNiceControl()方法的一些代码示例,展示了EasyMock.createNiceControl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EasyMock.createNiceControl()方法的具体详情如下:
包路径:org.easymock.EasyMock
类名称:EasyMock
方法名:createNiceControl

EasyMock.createNiceControl介绍

[英]Creates a control, order checking is disabled by default, and the mock objects created by this control will return 0, null or false for unexpected invocations.
[中]创建控件,默认情况下禁用顺序检查,对于意外调用,此控件创建的模拟对象将返回0nullfalse

代码示例

代码示例来源:origin: org.easymock/easymock

/**
 * Creates a control, order checking is disabled by default, and the mock
 * objects created by this control will return {@code 0},
 * {@code null} or {@code false} for unexpected invocations.
 *
 * @return the control.
 */
public IMocksControl createNiceControl() {
  IMocksControl ctrl = EasyMock.createNiceControl();
  controls.add(ctrl);
  return ctrl;
}

代码示例来源:origin: org.easymock/easymock

/**
 * Creates a mock object that implements the given interface, order checking
 * is disabled by default, and the mock object will return {@code 0},
 * {@code null} or {@code false} for unexpected invocations.
 *
 * @param toMock
 *            the class or interface that should be mocked.
 * @param <T>
 *            the interface that the mock object should implement. It is expected to be of
 *            class {@code toMock}.
 * @return the mock object.
 *
 * @since 3.4
 */
public static <T> T niceMock(Class<?> toMock) {
  return createNiceControl().mock(toMock);
}

代码示例来源:origin: org.easymock/easymock

/**
 * Creates a mock object that implements the given interface, order checking
 * is disabled by default, and the mock object will return {@code 0},
 * {@code null} or {@code false} for unexpected invocations.
 *
 * @param name
 *            the name of the mock object.
 * @param toMock
 *            the class or interface that should be mocked.
 * @param <T>
 *            the interface that the mock object should implement. It is expected to be of
 *            class {@code toMock}.
 * @return the mock object.
 * @throws IllegalArgumentException
 *             if the name is not a valid Java identifier.
 *
 * @since 3.4
 */
public static <T> T niceMock(String name, Class<?> toMock) {
  return createNiceControl().mock(name, toMock);
}

代码示例来源:origin: org.easymock/easymock

public <R> R createNiceMock(String name) {
  IMocksControl control = (support == null ? EasyMock.createNiceControl() : support
      .createNiceControl());
  return createMock(name, control);
}

代码示例来源:origin: org.easymock/com.springsource.org.easymock

/**
 * Creates a control, order checking is disabled by default, and the mock
 * objects created by this control will return <code>0</code>,
 * <code>null</code> or <code>false</code> for unexpected invocations.
 * 
 * @return the control.
 */
public IMocksControl createNiceControl() {
  IMocksControl ctrl = EasyMock.createNiceControl();
  controls.add(ctrl);
  return ctrl;
}

代码示例来源:origin: org.easymock/com.springsource.org.easymock

/**
 * Creates a mock control object for the specified interface. The
 * <code>MockControl</code> and its associated mock object will not check
 * the order of expected method calls. An unexpected method call on the mock
 * object will return an empty value (0, null, false).
 *
 * @param <T> type of the mock controlled
 * @param toMock
 *            the class of the interface to mock.
 * @return the mock control.
 */
public static <T> MockControl<T> createNiceControl(Class<T> toMock) {
  return new MockControl<T>((MocksControl) EasyMock.createNiceControl(),
      toMock);
}

代码示例来源:origin: easymock/easymock

/**
 * Creates a mock object that implements the given interface, order checking
 * is disabled by default, and the mock object will return <code>0</code>,
 * <code>null</code> or <code>false</code> for unexpected invocations.
 * 
 * @param <T>
 *            the interface that the mock object should implement.
 * @param toMock
 *            the class of the interface that the mock object should
 *            implement.
 * @return the mock object.
 */
public static <T> T createNiceMock(Class<T> toMock) {
  return createNiceControl().createMock(toMock);
}

代码示例来源:origin: easymock/easymock

/**
 * Creates a mock control object for the specified interface. The
 * <code>MockControl</code> and its associated mock object will not check
 * the order of expected method calls. An unexpected method call on the mock
 * object will return an empty value (0, null, false).
 * 
 * @param toMock
 *            the class of the interface to mock.
 * @return the mock control.
 */
public static <T> MockControl<T> createNiceControl(Class<T> toMock) {
  return new MockControl<T>((MocksControl) EasyMock.createNiceControl(),
      toMock);
}

代码示例来源:origin: org.easymock/com.springsource.org.easymock

/**
 * Creates a mock object that implements the given interface, order checking
 * is disabled by default, and the mock object will return <code>0</code>,
 * <code>null</code> or <code>false</code> for unexpected invocations.
 * 
 * @param <T>
 *            the interface that the mock object should implement.
 * @param toMock
 *            the class of the interface that the mock object should
 *            implement.
 * @return the mock object.
 */
public static <T> T createNiceMock(Class<T> toMock) {
  return createNiceControl().createMock(toMock);
}

代码示例来源:origin: org.easymock/com.springsource.org.easymock

/**
 * Creates a mock object that implements the given interface, order checking
 * is disabled by default, and the mock object will return <code>0</code>,
 * <code>null</code> or <code>false</code> for unexpected invocations.
 * @param name the name of the mock object.
 * @param toMock
 *            the class of the interface that the mock object should
 *            implement.
 * 
 * @param <T>
 *            the interface that the mock object should implement.
 * @return the mock object.
 * @throws IllegalArgumentException if the name is not a valid Java identifier.
 */
public static <T> T createNiceMock(String name, Class<T> toMock) {
  return createNiceControl().createMock(name, toMock);
}

代码示例来源:origin: com.lmco.shindig/shindig-gadgets

@Before
public void setUp() throws Exception {
 control = EasyMock.createNiceControl();
 processor = control.createMock(Processor.class);
 lockedDomainService = control.createMock(LockedDomainService.class);
 oauthUriManager = control.createMock(OAuthUriManager.class);
 stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes());
 securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com",
   "gadget", "0", "default", MAKE_REQUEST_URL, null);
 gadget = control.createMock(Gadget.class);
 fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false);
 responseParams = new OAuthResponseParams(null, null, null);
}

代码示例来源:origin: org.apache.shindig/shindig-gadgets

@Before
public void setUp() throws Exception {
 control = EasyMock.createNiceControl();
 processor = control.createMock(Processor.class);
 lockedDomainService = control.createMock(LockedDomainService.class);
 oauthUriManager = control.createMock(OAuthUriManager.class);
 stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes());
 securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com",
   "gadget", "0", "default", MAKE_REQUEST_URL, null);
 gadget = control.createMock(Gadget.class);
 fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false);
 responseParams = new OAuthResponseParams(null, null, null);
}

代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets

@Before
public void setUp() throws Exception {
 control = EasyMock.createNiceControl();
 processor = control.createMock(Processor.class);
 lockedDomainService = control.createMock(LockedDomainService.class);
 oauthUriManager = control.createMock(OAuthUriManager.class);
 stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes());
 securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com",
   "gadget", "0", "default", MAKE_REQUEST_URL, null);
 gadget = control.createMock(Gadget.class);
 fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false);
 responseParams = new OAuthResponseParams(null, null, null);
}

相关文章