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

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

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

EasyMock.anyLong介绍

[英]Expects any long argument. For details, see the EasyMock documentation.
[中]期待任何长时间的争论。有关详细信息,请参阅EasyMock文档。

代码示例

代码示例来源:origin: linkedin/cruise-control

private BrokerFailureDetector createBrokerFailureDetector(Queue<Anomaly> anomalies, Time time) {
 LoadMonitor mockLoadMonitor = EasyMock.mock(LoadMonitor.class);
 KafkaCruiseControl mockKafkaCruiseControl = EasyMock.mock(KafkaCruiseControl.class);
 EasyMock.expect(mockLoadMonitor.brokersWithPartitions(anyLong())).andAnswer(() -> new HashSet<>(Arrays.asList(0, 1))).anyTimes();
 EasyMock.replay(mockLoadMonitor);
 Properties props = KafkaCruiseControlUnitTestUtils.getKafkaCruiseControlProperties();
 props.setProperty(KafkaCruiseControlConfig.ZOOKEEPER_CONNECT_CONFIG, zookeeper().getConnectionString());
 KafkaCruiseControlConfig kafkaCruiseControlConfig = new KafkaCruiseControlConfig(props);
 return new BrokerFailureDetector(kafkaCruiseControlConfig,
                  mockLoadMonitor,
                  anomalies,
                  time,
                  mockKafkaCruiseControl);
}

代码示例来源:origin: confluentinc/ksql

@Test
public void shouldReturnServiceUnavailableIfTimeoutWaitingForCommandSequenceNumber()
  throws Exception {
 // Given:
 commandQueue.ensureConsumedPast(anyLong(), anyObject());
 expectLastCall().andThrow(new TimeoutException("whoops"));
 replay(commandQueue);
 // Expect
 expectedException.expect(KsqlRestException.class);
 expectedException.expect(exceptionStatusCode(is(Code.SERVICE_UNAVAILABLE)));
 expectedException.expect(exceptionKsqlErrorMessage(errorMessage(is("whoops"))));
 expectedException.expect(
   exceptionKsqlErrorMessage(errorCode(is(Errors.ERROR_CODE_COMMAND_QUEUE_CATCHUP_TIMEOUT))));
 // When:
 testResource.streamQuery(new KsqlRequest(queryString, Collections.emptyMap(), 3L));
}

代码示例来源:origin: linkedin/cruise-control

.andReturn(new MetadataClient.ClusterAndGeneration(metadata.fetch(), 0))
    .anyTimes();
EasyMock.expect(mockMetadataClient.refreshMetadata(anyLong()))
    .andReturn(new MetadataClient.ClusterAndGeneration(metadata.fetch(), 0))
    .anyTimes();

代码示例来源:origin: linkedin/cruise-control

EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))
EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))

代码示例来源:origin: linkedin/cruise-control

EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))
EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))

代码示例来源:origin: linkedin/cruise-control

EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))
EasyMock.anyLong(),
EasyMock.eq(3000L),
EasyMock.eq(TimeUnit.MILLISECONDS)))

代码示例来源:origin: jclouds/legacy-jclouds

public void testListTimeoutException() throws Exception {
 ListenableFuture<PageSet<? extends StorageMetadata>> future = createMock(ListenableFuture.class);
 expect(future.get(anyLong(), anyObject(TimeUnit.class))).andThrow(new RuntimeException(new TimeoutException()));
 expect(future.cancel(true)).andReturn(true);
 replay(future);
 AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class);
 expect(asyncBlobStore.list(anyObject(String.class), anyObject(ListContainerOptions.class))).andReturn(future);
 replay(asyncBlobStore);
 deleter = new DeleteAllKeysInList(null, asyncBlobStore, null);
 try {
   deleter.execute(containerName, ListContainerOptions.NONE);
   fail();
 } catch (Exception e) {
   if (Throwables2.getFirstThrowableOfType(e, TimeoutException.class) == null) {
    throw e;
   }
 }
}

代码示例来源:origin: info.magnolia.cache/magnolia-cache-core

@Test
public void testFilterCacheRequest() throws Exception {
  final HttpServletRequest request = createStrictMock(HttpServletRequest.class);
  final HttpServletResponse response = createStrictMock(HttpServletResponse.class);
  final FilterChain chain = createStrictMock(FilterChain.class);
  expect(request.getAttribute(EasyMock.<String> anyObject())).andReturn(null).anyTimes();
  response.setHeader(CacheConstants.HEADER_CACHE_CONTROL, CacheConstants.HEADER_VALUE_MAX_AGE + "=86400, " + CacheConstants.HEADER_VALUE_PUBLIC);
  response.setDateHeader(eq(CacheConstants.HEADER_EXPIRES), anyLong());
  chain.doFilter(request, response);
  replay(request, response, chain);
  CacheHeadersFilter filter = new CacheHeadersFilter();
  filter.doFilter(request, response, chain);
  verify(request, response, chain);
}

代码示例来源:origin: NationalSecurityAgency/datawave

}).anyTimes();
mocked.getLong(EasyMock.anyObject(String.class), EasyMock.anyLong());
EasyMock.expectLastCall().andAnswer(() -> {

代码示例来源:origin: NationalSecurityAgency/datawave

}).anyTimes();
mocked.getLong(EasyMock.anyObject(String.class), EasyMock.anyLong());
EasyMock.expectLastCall().andAnswer(() -> {

代码示例来源:origin: GeoWebCache/geowebcache

eq(0L),
    eq(0),
    anyLong());
listener.tileStored(
    eq(layerName),
    eq(0L),
    eq(0),
    anyLong());
listener.tileStored(
    eq(layerName),
    eq(0L),
    eq(0),
    anyLong());

相关文章