当前位置: 首页>>代码示例>>Java>>正文


Java InvocationOnMock.getArgumentAt方法代码示例

本文整理汇总了Java中org.mockito.invocation.InvocationOnMock.getArgumentAt方法的典型用法代码示例。如果您正苦于以下问题:Java InvocationOnMock.getArgumentAt方法的具体用法?Java InvocationOnMock.getArgumentAt怎么用?Java InvocationOnMock.getArgumentAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mockito.invocation.InvocationOnMock的用法示例。


在下文中一共展示了InvocationOnMock.getArgumentAt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: answer

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
    String name = invocation.getArgumentAt(0, String.class);
    String value = invocation.getArgumentAt(1, String.class);
    apply(name, value);
    return null;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:8,代码来源:MockRequestBuilder.java

示例2: validateCloseToDisk

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
private void validateCloseToDisk(MemoryRun memoryRun, final int expectedRecordCount) throws Exception {
  // create a mock DiskRunManager and capture the spilled hyper batch
  DiskRunManager manager = Mockito.mock(DiskRunManager.class);
  Answer<Void> spillAnswer = new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
      VectorContainer hyperBatch = invocation.getArgumentAt(0, VectorContainer.class);
      validateHyperBatch(hyperBatch, expectedRecordCount);
      return null;
    }
  };

  Mockito.doAnswer(spillAnswer).when(manager).spill(Mockito.any(VectorContainer.class), Mockito.any(BufferAllocator.class));

  // closeToDisk expects the hyperBatch to be transferred to another allocator as it will be closing the memoryRun
  // so make sure we either transfer the batch or validate it in the answer above
  memoryRun.closeToDisk(manager);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:TestMemoryRun.java

示例3: answer

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
    File file = invocationOnMock.getArgumentAt(0, File.class);
    MediaFile mediaFile = new MediaFile();
    mediaFile.setPath(file.getPath());
    return mediaFile;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:8,代码来源:PlaylistServiceTestImport.java

示例4: answer

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
@Override
public HealthResponse answer(InvocationOnMock invocation) {
    URI uri = invocation.getArgumentAt(0, URI.class);
    List<String> pathSegments = UriComponentsBuilder.fromUri(uri).build().getPathSegments();
    String status = Iterables.getLast(pathSegments);
    if ("EXCEPTION".equals(status)) {
        throw new RestClientException("simulated exception");
    }
    return HealthResponse.builder().status(new Status(status)).build();
}
 
开发者ID:ePages-de,项目名称:spring-boot-readiness,代码行数:11,代码来源:MockRestTemplateAnswer.java

示例5: answer

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
  Object evalOn = invocation.getArgumentAt(0, Object.class);
  if (evalOn instanceof Portfolio) {
    Portfolio p = (Portfolio) evalOn;
    return p.indexKey;
  }
  return null;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:10,代码来源:HashIndexSetJUnitTest.java

示例6: applyToCursorAnswer

import org.mockito.invocation.InvocationOnMock; //导入方法依赖的package包/类
/**
 * To emulate side effect of void method.
 * {@link CursorAwareDataTreeModification#applyToCursor(DataTreeModificationCursor)}
 *
 * @param invocation invocation
 * @return void - always null
 */
protected static final <T> Answer<T> applyToCursorAnswer(final InvocationOnMock invocation) {
    final DataTreeModificationCursor cursor =
            invocation.getArgumentAt(0, DataTreeModificationCursor.class);
    cursor.write(PATH_1.getLastPathArgument(), DATA_1);
    cursor.merge(PATH_2.getLastPathArgument(), DATA_2);
    cursor.delete(PATH_3.getLastPathArgument());
    return null;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:LocalProxyTransactionTest.java


注:本文中的org.mockito.invocation.InvocationOnMock.getArgumentAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。