本文整理了Java中org.easymock.Capture.getValues()
方法的一些代码示例,展示了Capture.getValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Capture.getValues()
方法的具体详情如下:
包路径:org.easymock.Capture
类名称:Capture
方法名:getValues
[英]Return all captured values. It returns the actual list so you can modify it's content if needed
[中]
代码示例来源: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: confluentinc/ksql
@Test
public void testStopSendingAfterClose() {
replayOnSubscribe();
EasyMock.expect(session.getAsyncRemote()).andReturn(async).anyTimes();
final Capture<String> json = EasyMock.newCapture(CaptureType.ALL);
async.sendText(EasyMock.capture(json), EasyMock.anyObject());
subscription.request(1);
subscription.cancel();
EasyMock.replay(subscription, session, async);
subscriber.onNext(ImmutableList.of(ImmutableMap.of("a", 1)));
subscriber.close();
subscriber.onNext(ImmutableList.of(ImmutableMap.of("b", 2), ImmutableMap.of("c", 3)));
assertEquals(ImmutableList.of("{\"a\":1}"), json.getValues());
EasyMock.verify(subscription, session, async);
}
代码示例来源:origin: apache/incubator-druid
Assert.assertTrue(eventCapture.hasCaptured());
final List<Map<String, Object>> events = Lists.transform(
eventCapture.getValues(),
new Function<ServiceEventBuilder<ServiceMetricEvent>, Map<String, Object>>()
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void testSaveAndRestore() throws IOException {
expect(storageRpcMock.open(BLOB_INFO.toPb(), EMPTY_RPC_OPTIONS)).andReturn(UPLOAD_ID);
Capture<byte[]> capturedBuffer = Capture.newInstance(CaptureType.ALL);
Capture<Long> capturedPosition = Capture.newInstance(CaptureType.ALL);
storageRpcMock.write(
eq(UPLOAD_ID),
capture(capturedBuffer),
eq(0),
captureLong(capturedPosition),
eq(DEFAULT_CHUNK_SIZE),
eq(false));
expectLastCall().times(2);
replay(storageRpcMock);
ByteBuffer buffer1 = randomBuffer(DEFAULT_CHUNK_SIZE);
ByteBuffer buffer2 = randomBuffer(DEFAULT_CHUNK_SIZE);
writer = new BlobWriteChannel(options, BLOB_INFO, EMPTY_RPC_OPTIONS);
assertEquals(DEFAULT_CHUNK_SIZE, writer.write(buffer1));
assertArrayEquals(buffer1.array(), capturedBuffer.getValues().get(0));
assertEquals(new Long(0L), capturedPosition.getValues().get(0));
RestorableState<WriteChannel> writerState = writer.capture();
WriteChannel restoredWriter = writerState.restore();
assertEquals(DEFAULT_CHUNK_SIZE, restoredWriter.write(buffer2));
assertArrayEquals(buffer2.array(), capturedBuffer.getValues().get(1));
assertEquals(new Long(DEFAULT_CHUNK_SIZE), capturedPosition.getValues().get(1));
}
代码示例来源:origin: apache/incubator-druid
DruidNode param = captured.getValues().get(0);
Assert.assertEquals(TEST_SERVICE_NAME, param.getServiceName());
Assert.assertEquals(TEST_HOST, param.getHost());
verifyAll();
param = captured.getValues().get(0);
Assert.assertEquals(TEST_SERVICE_NAME, param.getServiceName());
Assert.assertEquals(TEST_HOST, param.getHost());
代码示例来源:origin: confluentinc/ksql
@Test
public void testSanity() throws Exception {
replayOnSubscribe();
EasyMock.expect(session.getAsyncRemote()).andReturn(async).anyTimes();
final Capture<String> json = EasyMock.newCapture(CaptureType.ALL);
async.sendText(EasyMock.capture(json), EasyMock.anyObject());
EasyMock.expectLastCall().times(3);
subscription.request(1);
EasyMock.expectLastCall().once();
session.close(EasyMock.anyObject());
EasyMock.expectLastCall().once();
subscription.cancel();
EasyMock.replay(subscription, session, async);
subscriber.onNext(ImmutableList.of(ImmutableMap.of("a", 1), ImmutableMap.of("b", 2), ImmutableMap.of("c", 3)));
assertEquals(ImmutableList.of("{\"a\":1}","{\"b\":2}","{\"c\":3}"), json.getValues());
subscriber.onComplete();
subscriber.close();
EasyMock.verify(subscription, session, async);
}
代码示例来源:origin: googleapis/google-cloud-java
writer = new TableDataWriteChannel(options, JOB_INFO.getJobId(), LOAD_CONFIGURATION);
assertEquals(DEFAULT_CHUNK_SIZE, writer.write(buffer1));
assertArrayEquals(buffer1.array(), capturedBuffer.getValues().get(0));
assertEquals(new Long(0L), capturedPosition.getValues().get(0));
assertNull(writer.getJob());
RestorableState<WriteChannel> writerState = writer.capture();
WriteChannel restoredWriter = writerState.restore();
assertEquals(DEFAULT_CHUNK_SIZE, restoredWriter.write(buffer2));
assertArrayEquals(buffer2.array(), capturedBuffer.getValues().get(1));
assertEquals(new Long(DEFAULT_CHUNK_SIZE), capturedPosition.getValues().get(1));
代码示例来源:origin: org.easymock/com.springsource.org.easymock
/**
* Return captured value
*
* @throws AssertionError
* if nothing was captured yet or if more than one value was
* captured
* @return The last captured value
*/
public T getValue() {
if (values.isEmpty()) {
throw new AssertionError("Nothing captured yet");
}
if (values.size() > 1) {
throw new AssertionError("More than one value captured: "
+ getValues());
}
return values.get(values.size() - 1);
}
代码示例来源:origin: GeoWebCache/geowebcache
/** Override because setValue with anyTimes() resets the list of values */
@Override
public void setValue(TileObject o) {
super.getValues().add(o);
}
};
代码示例来源:origin: org.hawkular.titan/titan-test
@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: com.nesscomputing.components/ness-quartz
@Test
public void testSimple() throws Exception
{
AdHocQuartzJob.forClass(DummyJob.class).name("test-simple").submitConditional(scheduler, nessJobConfig);
Assert.assertNotNull(jobDetailCapture.getValues());
Assert.assertEquals(0, jobAddCapture.getValues().size());
Assert.assertEquals(1, jobDetailCapture.getValues().size());
Assert.assertNotNull(jobDetailCapture.getValue());
Assert.assertEquals(DummyJob.class, jobDetailCapture.getValue().getJobClass());
}
代码示例来源:origin: com.nesscomputing.components/ness-quartz
@Test
public void testExplicitSkipped() throws Exception
{
AdHocQuartzJob.forClass(DummyJob.class).name("testExplicitSkipped").conditional("ness.job.explicit-never.run.enabled").submitConditional(scheduler, nessJobConfig);
Assert.assertNotNull(jobDetailCapture.getValues());
Assert.assertEquals(0, jobDetailCapture.getValues().size());
Assert.assertEquals(1, jobAddCapture.getValues().size());
Assert.assertNotNull(jobAddCapture.getValue());
Assert.assertEquals(DummyJob.class, jobAddCapture.getValue().getJobClass());
}
代码示例来源:origin: com.nesscomputing.components/ness-quartz
@Test
public void testExplicitRunning() throws Exception
{
AdHocQuartzJob.forClass(DummyJob.class).name("testExplicitRunning").conditional("ness.job.explicit-running.enabled").submitConditional(scheduler, nessJobConfig);
Assert.assertEquals(0, jobAddCapture.getValues().size());
Assert.assertNotNull(jobDetailCapture.getValues());
Assert.assertEquals(1, jobDetailCapture.getValues().size());
Assert.assertNotNull(jobDetailCapture.getValue());
Assert.assertEquals(DummyJob.class, jobDetailCapture.getValue().getJobClass());
}
代码示例来源:origin: com.nesscomputing.components/ness-quartz
@Test
public void testSkipped() throws Exception
{
AdHocQuartzJob.forClass(DummyJob.class).name("testSkipped").conditional("never-run").submitConditional(scheduler, nessJobConfig);
Assert.assertNotNull(jobDetailCapture.getValues());
Assert.assertEquals(0, jobDetailCapture.getValues().size());
Assert.assertEquals(1, jobAddCapture.getValues().size());
Assert.assertNotNull(jobAddCapture.getValue());
Assert.assertEquals(DummyJob.class, jobAddCapture.getValue().getJobClass());
}
代码示例来源:origin: com.nesscomputing.components/ness-quartz
@Test
public void testRunningLong() throws Exception
{
AdHocQuartzJob.forClass(DummyJob.class).name("testRunningLong").conditional("running-long").submitConditional(scheduler, nessJobConfig);
Assert.assertNotNull(jobDetailCapture.getValues());
Assert.assertEquals(0, jobAddCapture.getValues().size());
Assert.assertEquals(1, jobDetailCapture.getValues().size());
Assert.assertNotNull(jobDetailCapture.getValue());
Assert.assertEquals(DummyJob.class, jobDetailCapture.getValue().getJobClass());
}
代码示例来源:origin: GeoWebCache/geowebcache
Sets.newHashSet(config.getLayers()), is(Sets.newHashSet(layerCapture.getValues())));
代码示例来源:origin: GeoWebCache/geowebcache
layer.seedTile(tile, tryCache);
assertEquals(9, captured.getValues().size());
verify(mockStorageBroker);
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
assertEquals(mapNbTrees, capturedKeys.getValues().size());
for (TreeID k : capturedKeys.getValues()) {
assertEquals(partition, k.partition());
assertEquals(treeIndex, k.treeId());
代码示例来源:origin: GeoWebCache/geowebcache
layer.seedTile(tile, tryCache);
assertEquals(1, captured.getValues().size());
TileObject value = captured.getValue();
assertNotNull(value);
内容来源于网络,如有侵权,请联系作者删除!