本文整理了Java中org.easymock.Capture.hasCaptured()
方法的一些代码示例,展示了Capture.hasCaptured()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Capture.hasCaptured()
方法的具体详情如下:
包路径:org.easymock.Capture
类名称:Capture
方法名:hasCaptured
暂无
代码示例来源:origin: org.easymock/easymock
/**
* Used internally by the EasyMock framework to add a new captured value
*
* @param value
* Value captured
*/
public void setValue(T value) {
switch (type) {
case NONE:
break;
case ALL:
values.add(value);
break;
case FIRST:
if (!hasCaptured()) {
values.add(value);
}
break;
case LAST:
if (hasCaptured()) {
reset();
}
values.add(value);
break;
// ///CLOVER:OFF
default:
throw new IllegalArgumentException("Unknown capture type: " + type);
// ///CLOVER:ON
}
}
代码示例来源:origin: thinkaurelius/titan
@After
public void verifyMocks() {
ctrl.verify();
ctrl.reset();
// Check capture created in the @Before method
assertTrue(txConfigCapture.hasCaptured());
List<BaseTransactionConfig> txCfgs = txConfigCapture.getValues();
assertEquals(2, txCfgs.size());
// First backing store transaction should use default tx config
assertEquals("default", txCfgs.get(0).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
// Second backing store transaction should use global strong consistency config
assertEquals("global", txCfgs.get(1).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
// The order in which these transactions are opened isn't really significant;
// testing them in order is kind of overspecifying the impl's behavior.
// Could probably relax the ordering selectively here with some thought, but
// I want to keep order checking on in general for the EasyMock control.
}
代码示例来源:origin: JanusGraph/janusgraph
@After
public void verifyMocks() {
ctrl.verify();
ctrl.reset();
// Check capture created in the @Before method
assertTrue(txConfigCapture.hasCaptured());
List<BaseTransactionConfig> transactionConfigurations = txConfigCapture.getValues();
assertEquals(2, transactionConfigurations.size());
// First backing store transaction should use default tx config
assertEquals("default", transactionConfigurations.get(0).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
// Second backing store transaction should use global strong consistency config
assertEquals("global", transactionConfigurations.get(1).getCustomOption(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID));
// The order in which these transactions are opened isn't really significant;
// testing them in order is kind of over-specifying the implementation's behavior.
// Could probably relax the ordering selectively here with some thought, but
// I want to keep order checking on in general for the EasyMock control.
}
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(eventCapture.hasCaptured());
final List<Map<String, Object>> events = Lists.transform(
eventCapture.getValues(),
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/avro
= outputFormat.getRecordWriter(context);
assertTrue(capturedCodecFactory.hasCaptured());
assertEquals(expectedCodec.toString(), capturedCodecFactory.getValue().toString());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
代码示例来源:origin: apache/incubator-druid
queriesStarted.await();
Assert.assertTrue(capturedFuture.hasCaptured());
ListenableFuture future = capturedFuture.getValue();
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(capturedFuture.hasCaptured());
ListenableFuture future = capturedFuture.getValue();
future.cancel(true);
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue("Capture cache keys", cacheKeyCapture.hasCaptured());
Assert.assertTrue("Cache key below limit", ImmutableList.copyOf(cacheKeyCapture.getValue()).size() <= limit);
EasyMock.verify(cache);
EasyMock.verify(dataSegment);
Assert.assertTrue("Capture cache keys", cacheKeyCapture.hasCaptured());
Assert.assertTrue("Cache Keys empty", ImmutableList.copyOf(cacheKeyCapture.getValue()).isEmpty());
代码示例来源:origin: apache/incubator-druid
query = query.withOverriddenContext(ImmutableMap.of(DirectDruidClient.QUERY_FAIL_TIME, Long.MAX_VALUE));
Sequence s1 = client1.run(QueryPlus.wrap(query), defaultContext);
Assert.assertTrue(capturedRequest.hasCaptured());
Assert.assertEquals(url, capturedRequest.getValue().getUrl());
Assert.assertEquals(HttpMethod.POST, capturedRequest.getValue().getMethod());
代码示例来源:origin: apache/httpcomponents-client
private ClassicHttpResponse testRequestWithWeakETagValidatorIsNotAllowed(final String header) throws Exception {
final Capture<ClassicHttpRequest> cap = EasyMock.newCapture();
EasyMock.expect(
mockExecChain.proceed(
EasyMock.capture(cap),
EasyMock.isA(ExecChain.Scope.class))).andReturn(originResponse).times(0, 1);
replayMocks();
final ClassicHttpResponse response = execute(request);
verifyMocks();
// it's probably ok to return a 400 (Bad Request) to this client
if (cap.hasCaptured()) {
final ClassicHttpRequest forwarded = cap.getValue();
final Header h = forwarded.getFirstHeader(header);
if (h != null) {
Assert.assertFalse(h.getValue().startsWith("W/"));
}
}
return response;
}
代码示例来源:origin: apache/httpcomponents-client
@Test
public void testNoCacheOnFieldIsNotReturnedWithoutRevalidation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("ETag","\"etag\"");
resp1.setHeader("X-Stuff","things");
resp1.setHeader("Cache-Control","no-cache=\"X-Stuff\", max-age=3600");
backendExpectsAnyRequestAndReturn(resp1);
final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp2 = HttpTestUtils.make200Response();
resp2.setHeader("ETag","\"etag\"");
resp2.setHeader("X-Stuff","things");
resp2.setHeader("Cache-Control","no-cache=\"X-Stuff\",max-age=3600");
final Capture<ClassicHttpRequest> cap = EasyMock.newCapture();
EasyMock.expect(
mockExecChain.proceed(
EasyMock.capture(cap),
EasyMock.isA(ExecChain.Scope.class))).andReturn(resp2).times(0,1);
replayMocks();
execute(req1);
final ClassicHttpResponse result = execute(req2);
verifyMocks();
if (!cap.hasCaptured()) {
Assert.assertNull(result.getFirstHeader("X-Stuff"));
}
}
内容来源于网络,如有侵权,请联系作者删除!