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

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

本文整理了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

  1. private BrokerFailureDetector createBrokerFailureDetector(Queue<Anomaly> anomalies, Time time) {
  2. LoadMonitor mockLoadMonitor = EasyMock.mock(LoadMonitor.class);
  3. KafkaCruiseControl mockKafkaCruiseControl = EasyMock.mock(KafkaCruiseControl.class);
  4. EasyMock.expect(mockLoadMonitor.brokersWithPartitions(anyLong())).andAnswer(() -> new HashSet<>(Arrays.asList(0, 1))).anyTimes();
  5. EasyMock.replay(mockLoadMonitor);
  6. Properties props = KafkaCruiseControlUnitTestUtils.getKafkaCruiseControlProperties();
  7. props.setProperty(KafkaCruiseControlConfig.ZOOKEEPER_CONNECT_CONFIG, zookeeper().getConnectionString());
  8. KafkaCruiseControlConfig kafkaCruiseControlConfig = new KafkaCruiseControlConfig(props);
  9. return new BrokerFailureDetector(kafkaCruiseControlConfig,
  10. mockLoadMonitor,
  11. anomalies,
  12. time,
  13. mockKafkaCruiseControl);
  14. }

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

  1. @Test
  2. public void shouldReturnServiceUnavailableIfTimeoutWaitingForCommandSequenceNumber()
  3. throws Exception {
  4. // Given:
  5. commandQueue.ensureConsumedPast(anyLong(), anyObject());
  6. expectLastCall().andThrow(new TimeoutException("whoops"));
  7. replay(commandQueue);
  8. // Expect
  9. expectedException.expect(KsqlRestException.class);
  10. expectedException.expect(exceptionStatusCode(is(Code.SERVICE_UNAVAILABLE)));
  11. expectedException.expect(exceptionKsqlErrorMessage(errorMessage(is("whoops"))));
  12. expectedException.expect(
  13. exceptionKsqlErrorMessage(errorCode(is(Errors.ERROR_CODE_COMMAND_QUEUE_CATCHUP_TIMEOUT))));
  14. // When:
  15. testResource.streamQuery(new KsqlRequest(queryString, Collections.emptyMap(), 3L));
  16. }

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

  1. .andReturn(new MetadataClient.ClusterAndGeneration(metadata.fetch(), 0))
  2. .anyTimes();
  3. EasyMock.expect(mockMetadataClient.refreshMetadata(anyLong()))
  4. .andReturn(new MetadataClient.ClusterAndGeneration(metadata.fetch(), 0))
  5. .anyTimes();

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

  1. EasyMock.anyLong(),
  2. EasyMock.eq(3000L),
  3. EasyMock.eq(TimeUnit.MILLISECONDS)))
  4. EasyMock.anyLong(),
  5. EasyMock.eq(3000L),
  6. EasyMock.eq(TimeUnit.MILLISECONDS)))

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

  1. EasyMock.anyLong(),
  2. EasyMock.eq(3000L),
  3. EasyMock.eq(TimeUnit.MILLISECONDS)))
  4. EasyMock.anyLong(),
  5. EasyMock.eq(3000L),
  6. EasyMock.eq(TimeUnit.MILLISECONDS)))

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

  1. EasyMock.anyLong(),
  2. EasyMock.eq(3000L),
  3. EasyMock.eq(TimeUnit.MILLISECONDS)))
  4. EasyMock.anyLong(),
  5. EasyMock.eq(3000L),
  6. EasyMock.eq(TimeUnit.MILLISECONDS)))

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

  1. public void testListTimeoutException() throws Exception {
  2. ListenableFuture<PageSet<? extends StorageMetadata>> future = createMock(ListenableFuture.class);
  3. expect(future.get(anyLong(), anyObject(TimeUnit.class))).andThrow(new RuntimeException(new TimeoutException()));
  4. expect(future.cancel(true)).andReturn(true);
  5. replay(future);
  6. AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class);
  7. expect(asyncBlobStore.list(anyObject(String.class), anyObject(ListContainerOptions.class))).andReturn(future);
  8. replay(asyncBlobStore);
  9. deleter = new DeleteAllKeysInList(null, asyncBlobStore, null);
  10. try {
  11. deleter.execute(containerName, ListContainerOptions.NONE);
  12. fail();
  13. } catch (Exception e) {
  14. if (Throwables2.getFirstThrowableOfType(e, TimeoutException.class) == null) {
  15. throw e;
  16. }
  17. }
  18. }

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

  1. @Test
  2. public void testFilterCacheRequest() throws Exception {
  3. final HttpServletRequest request = createStrictMock(HttpServletRequest.class);
  4. final HttpServletResponse response = createStrictMock(HttpServletResponse.class);
  5. final FilterChain chain = createStrictMock(FilterChain.class);
  6. expect(request.getAttribute(EasyMock.<String> anyObject())).andReturn(null).anyTimes();
  7. response.setHeader(CacheConstants.HEADER_CACHE_CONTROL, CacheConstants.HEADER_VALUE_MAX_AGE + "=86400, " + CacheConstants.HEADER_VALUE_PUBLIC);
  8. response.setDateHeader(eq(CacheConstants.HEADER_EXPIRES), anyLong());
  9. chain.doFilter(request, response);
  10. replay(request, response, chain);
  11. CacheHeadersFilter filter = new CacheHeadersFilter();
  12. filter.doFilter(request, response, chain);
  13. verify(request, response, chain);
  14. }

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

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

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

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

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

  1. eq(0L),
  2. eq(0),
  3. anyLong());
  4. listener.tileStored(
  5. eq(layerName),
  6. eq(0L),
  7. eq(0),
  8. anyLong());
  9. listener.tileStored(
  10. eq(layerName),
  11. eq(0L),
  12. eq(0),
  13. anyLong());

相关文章