本文整理汇总了Java中org.jmock.api.Invocation.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Invocation.getParameter方法的具体用法?Java Invocation.getParameter怎么用?Java Invocation.getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jmock.api.Invocation
的用法示例。
在下文中一共展示了Invocation.getParameter方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: returnInstantiatedAndInitializedViewModel
import org.jmock.api.Invocation; //导入方法依赖的package包/类
private Action returnInstantiatedAndInitializedViewModel() {
return new Action() {
@Override
public Object invoke(Invocation invocation) throws Throwable {
final Class<?> cls = (Class<?>) invocation.getParameter(0);
final String memento = (String) invocation.getParameter(1);
final ViewModel viewModelInstance = (ViewModel) cls.newInstance();
viewModelInstance.viewModelInit(memento);
if(viewModelInstance instanceof UserPermissionViewModel) {
((UserPermissionViewModel) viewModelInstance).applicationPermissionRepository = mockApplicationPermissionRepository;
}
return viewModelInstance;
}
@Override
public void describeTo(Description description) {
description.appendText("return instantiated and initialized view model ");
}
};
}
示例2: addToInMemoryDB
import org.jmock.api.Invocation; //导入方法依赖的package包/类
private Action addToInMemoryDB() {
return new Action() {
@Override
public Object invoke(Invocation invocation) throws Throwable {
final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class);
final String name = (String)invocation.getParameter(0);
final SimpleObject obj = new SimpleObject();
obj.setName(name);
inMemoryDB.put(SimpleObject.class, name, obj);
return obj;
}
@Override
public void describeTo(Description description) {
description.appendText("add to database");
}
};
}
示例3: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
@Override
public Object invoke(Invocation invocation) throws Throwable {
byte[] tag = (byte[]) invocation.getParameter(0);
random.nextBytes(tag);
if (tags != null) tags.add(tag);
return null;
}
示例4: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
@Override
public Object invoke(Invocation invocation) throws Throwable {
BdfDictionary d = (BdfDictionary) invocation.getParameter(0);
assertEquals(outgoingPosition, d.getLong("nextOut").longValue());
assertEquals(incomingPosition, d.getLong("nextIn").longValue());
assertEquals(pending, d.getList("pending"));
return new byte[123];
}
示例5: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public Object invoke(Invocation invocation) throws Throwable {
byte[] tag = (byte[]) invocation.getParameter(0);
SecretKey key = (SecretKey) invocation.getParameter(1);
long streamNumber = (Long) invocation.getParameter(2);
encodeTag(tag, key.getEncoded(), streamNumber);
return null;
}
示例6: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public Object invoke(Invocation invocation) throws Throwable {
byte[] tag = (byte[]) invocation.getParameter(0);
long streamNumber = (Long) invocation.getParameter(2);
// Encode a fake tag based on the stream number
ByteUtils.writeUint32(streamNumber, tag, 0);
return null;
}
示例7: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public Object invoke(Invocation invocation) throws Throwable {
DuplexTransportConnection conn =
(DuplexTransportConnection) invocation.getParameter(1);
conn.getReader().dispose(false, true);
conn.getWriter().dispose(false);
invoked.countDown();
return null;
}
示例8: executeCallableAndReturn
import org.jmock.api.Invocation; //导入方法依赖的package包/类
private static Action executeCallableAndReturn() {
return new Action() {
@Override
public Object invoke(Invocation invocation) throws Throwable {
Callable<Object> callable = (Callable<Object>) invocation.getParameter(0);
return callable.call();
}
@Override
public void describeTo(Description description) {
description.appendText("execute arg 0 as callable and return");
}
};
}
示例9: returnLeaseTerm
import org.jmock.api.Invocation; //导入方法依赖的package包/类
private Action returnLeaseTerm() {
return new Action() {
@Override
public Object invoke(Invocation invocation) throws Throwable {
LeaseItem leaseItem = (LeaseItem) invocation.getParameter(0);
LeaseTerm leaseTerm = (LeaseTerm) invocation.getParameter(1);
LocalDate startDate = (LocalDate) invocation.getParameter(2);
LocalDate endDate = (LocalDate) invocation.getParameter(3);
LeaseTermForTesting ltt = new LeaseTermForTesting();
// relationships
ltt.setLeaseItem(leaseItem);
leaseItem.getTerms().add(ltt);
ltt.setPrevious(leaseTerm);
leaseTerm.setNext(ltt);
// set values
ltt.modifyStartDate(startDate);
ltt.modifyEndDate(endDate);
ltt.clockService = mockClockService;
return ltt;
}
@Override
public void describeTo(Description description) {
description.appendText("new Lease Term under item and with previous term");
}
};
}
示例10: saveLocalFileName
import org.jmock.api.Invocation; //导入方法依赖的package包/类
private CustomAction saveLocalFileName() {
return new CustomAction("file") {
public Object invoke(Invocation invocation) throws Throwable {
localFileName = (String) invocation.getParameter(0);
return new ByteArrayOutputStream();
}
};
}
示例11: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
@Override
public Object invoke(Invocation invocation) throws Throwable {
Runnable task = (Runnable) invocation.getParameter(0);
task.run();
return null;
}
示例12: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
@Override
public Object invoke(Invocation invocation) throws Throwable {
final ByteBuffer buffer = (ByteBuffer) invocation.getParameter(0);
buffer.position(buffer.limit());
return super.invoke(invocation);
}
示例13: invoke
import org.jmock.api.Invocation; //导入方法依赖的package包/类
@Override
public Object invoke(final Invocation invocation) throws Throwable {
final Object arg0 = invocation.getParameter(0);
finderInteraction[0] = new FinderInteraction( arg0 instanceof Query ? (Query<?>) arg0 : null, finderMethod);
return null;
}