org.easymock.Capture.hasCaptured()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(112)

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

Capture.hasCaptured介绍

暂无

代码示例

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

  1. /**
  2. * Used internally by the EasyMock framework to add a new captured value
  3. *
  4. * @param value
  5. * Value captured
  6. */
  7. public void setValue(T value) {
  8. switch (type) {
  9. case NONE:
  10. break;
  11. case ALL:
  12. values.add(value);
  13. break;
  14. case FIRST:
  15. if (!hasCaptured()) {
  16. values.add(value);
  17. }
  18. break;
  19. case LAST:
  20. if (hasCaptured()) {
  21. reset();
  22. }
  23. values.add(value);
  24. break;
  25. // ///CLOVER:OFF
  26. default:
  27. throw new IllegalArgumentException("Unknown capture type: " + type);
  28. // ///CLOVER:ON
  29. }
  30. }

代码示例来源:origin: thinkaurelius/titan

  1. @After
  2. public void verifyMocks() {
  3. ctrl.verify();
  4. ctrl.reset();
  5. // Check capture created in the @Before method
  6. assertTrue(txConfigCapture.hasCaptured());
  7. List<BaseTransactionConfig> txCfgs = txConfigCapture.getValues();
  8. assertEquals(2, txCfgs.size());
  9. // First backing store transaction should use default tx config
  10. assertEquals("default", txCfgs.get(0).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
  11. // Second backing store transaction should use global strong consistency config
  12. assertEquals("global", txCfgs.get(1).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
  13. // The order in which these transactions are opened isn't really significant;
  14. // testing them in order is kind of overspecifying the impl's behavior.
  15. // Could probably relax the ordering selectively here with some thought, but
  16. // I want to keep order checking on in general for the EasyMock control.
  17. }

代码示例来源:origin: JanusGraph/janusgraph

  1. @After
  2. public void verifyMocks() {
  3. ctrl.verify();
  4. ctrl.reset();
  5. // Check capture created in the @Before method
  6. assertTrue(txConfigCapture.hasCaptured());
  7. List<BaseTransactionConfig> transactionConfigurations = txConfigCapture.getValues();
  8. assertEquals(2, transactionConfigurations.size());
  9. // First backing store transaction should use default tx config
  10. assertEquals("default", transactionConfigurations.get(0).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
  11. // Second backing store transaction should use global strong consistency config
  12. assertEquals("global", transactionConfigurations.get(1).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
  13. // The order in which these transactions are opened isn't really significant;
  14. // testing them in order is kind of over-specifying the implementation's behavior.
  15. // Could probably relax the ordering selectively here with some thought, but
  16. // I want to keep order checking on in general for the EasyMock control.
  17. }

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(eventCapture.hasCaptured());
  2. final List<Map<String, Object>> events = Lists.transform(
  3. eventCapture.getValues(),

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/avro

  1. = outputFormat.getRecordWriter(context);
  2. assertTrue(capturedCodecFactory.hasCaptured());
  3. assertEquals(expectedCodec.toString(), capturedCodecFactory.getValue().toString());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(auditInfoCapture.hasCaptured());
  2. final AuditInfo auditInfo = auditInfoCapture.getValue();
  3. Assert.assertEquals(author, auditInfo.getAuthor());

代码示例来源:origin: apache/incubator-druid

  1. queriesStarted.await();
  2. Assert.assertTrue(capturedFuture.hasCaptured());
  3. ListenableFuture future = capturedFuture.getValue();

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue(capturedFuture.hasCaptured());
  2. ListenableFuture future = capturedFuture.getValue();
  3. future.cancel(true);

代码示例来源:origin: apache/incubator-druid

  1. Assert.assertTrue("Capture cache keys", cacheKeyCapture.hasCaptured());
  2. Assert.assertTrue("Cache key below limit", ImmutableList.copyOf(cacheKeyCapture.getValue()).size() <= limit);
  3. EasyMock.verify(cache);
  4. EasyMock.verify(dataSegment);
  5. Assert.assertTrue("Capture cache keys", cacheKeyCapture.hasCaptured());
  6. Assert.assertTrue("Cache Keys empty", ImmutableList.copyOf(cacheKeyCapture.getValue()).isEmpty());

代码示例来源:origin: apache/incubator-druid

  1. query = query.withOverriddenContext(ImmutableMap.of(DirectDruidClient.QUERY_FAIL_TIME, Long.MAX_VALUE));
  2. Sequence s1 = client1.run(QueryPlus.wrap(query), defaultContext);
  3. Assert.assertTrue(capturedRequest.hasCaptured());
  4. Assert.assertEquals(url, capturedRequest.getValue().getUrl());
  5. Assert.assertEquals(HttpMethod.POST, capturedRequest.getValue().getMethod());

代码示例来源:origin: apache/httpcomponents-client

  1. private ClassicHttpResponse testRequestWithWeakETagValidatorIsNotAllowed(final String header) throws Exception {
  2. final Capture<ClassicHttpRequest> cap = EasyMock.newCapture();
  3. EasyMock.expect(
  4. mockExecChain.proceed(
  5. EasyMock.capture(cap),
  6. EasyMock.isA(ExecChain.Scope.class))).andReturn(originResponse).times(0, 1);
  7. replayMocks();
  8. final ClassicHttpResponse response = execute(request);
  9. verifyMocks();
  10. // it's probably ok to return a 400 (Bad Request) to this client
  11. if (cap.hasCaptured()) {
  12. final ClassicHttpRequest forwarded = cap.getValue();
  13. final Header h = forwarded.getFirstHeader(header);
  14. if (h != null) {
  15. Assert.assertFalse(h.getValue().startsWith("W/"));
  16. }
  17. }
  18. return response;
  19. }

代码示例来源:origin: apache/httpcomponents-client

  1. @Test
  2. public void testNoCacheOnFieldIsNotReturnedWithoutRevalidation() throws Exception {
  3. final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
  4. final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
  5. resp1.setHeader("ETag","\"etag\"");
  6. resp1.setHeader("X-Stuff","things");
  7. resp1.setHeader("Cache-Control","no-cache=\"X-Stuff\", max-age=3600");
  8. backendExpectsAnyRequestAndReturn(resp1);
  9. final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
  10. final ClassicHttpResponse resp2 = HttpTestUtils.make200Response();
  11. resp2.setHeader("ETag","\"etag\"");
  12. resp2.setHeader("X-Stuff","things");
  13. resp2.setHeader("Cache-Control","no-cache=\"X-Stuff\",max-age=3600");
  14. final Capture<ClassicHttpRequest> cap = EasyMock.newCapture();
  15. EasyMock.expect(
  16. mockExecChain.proceed(
  17. EasyMock.capture(cap),
  18. EasyMock.isA(ExecChain.Scope.class))).andReturn(resp2).times(0,1);
  19. replayMocks();
  20. execute(req1);
  21. final ClassicHttpResponse result = execute(req2);
  22. verifyMocks();
  23. if (!cap.hasCaptured()) {
  24. Assert.assertNull(result.getFirstHeader("X-Stuff"));
  25. }
  26. }

相关文章