本文整理汇总了Java中org.jmock.api.Invocation.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Invocation.toString方法的具体用法?Java Invocation.toString怎么用?Java Invocation.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jmock.api.Invocation
的用法示例。
在下文中一共展示了Invocation.toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMethodToStringWithObjectArg
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public void testMethodToStringWithObjectArg() throws Exception {
final String argAsString = "TO_STRING_RESULT";
Object arg = new Object()
{
@Override public String toString() {
return argAsString;
}
};
Invocation invocation = new Invocation(INVOKED, methodFactory.newMethod(METHOD_NAME, new Class[]{String.class}, void.class, EXCEPTION_TYPES),
new Object[]{arg});
String result = invocation.toString();
AssertThat.stringIncludes("Should contain invokedMethod name", METHOD_NAME, result);
AssertThat.stringIncludes("Should contain firstArg", argAsString, result);
}
示例2: testToStringWithTwoArguments
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public void testToStringWithTwoArguments() throws Exception {
Invocation invocation = new Invocation(INVOKED,
methodFactory.newMethod(METHOD_NAME, new Class[]{String.class, String.class}, void.class,
EXCEPTION_TYPES),
new Object[]{"arg1", "arg2"});
String result = invocation.toString();
AssertThat.stringIncludes("Should contain object name", INVOKED.toString(), result);
AssertThat.stringIncludes("Should contain method name", METHOD_NAME, result);
AssertThat.stringIncludes("Should contain firstArg", "arg1", result);
AssertThat.stringIncludes("Should contain second Arg", "arg2", result);
}
示例3: testToStringWithStringArray
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public void testToStringWithStringArray() throws Exception {
Invocation invocation = new Invocation(INVOKED,
methodFactory.newMethod(METHOD_NAME, new Class[]{String[].class}, void.class, EXCEPTION_TYPES),
new Object[]{new String[]{"arg1", "arg2"}});
String result = invocation.toString();
AssertThat.stringIncludes("Should contain method name", METHOD_NAME, result);
AssertThat.stringIncludes("Should contain args as an array", "[\"arg1\", \"arg2\"]", result);
}
示例4: testToStringWithPrimitiveArray
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public void testToStringWithPrimitiveArray() throws Exception {
Invocation invocation = new Invocation(INVOKED,
methodFactory.newMethod(METHOD_NAME, new Class[]{long[].class}, void.class, EXCEPTION_TYPES),
new Object[]{new long[]{1, 2}});
String result = invocation.toString();
AssertThat.stringIncludes("Should contain invokedMethod name", METHOD_NAME, result);
AssertThat.stringIncludes("Should contain args as an array", "[<1L>, <2L>]", result);
}
示例5: testMethodToStringWithNullArg
import org.jmock.api.Invocation; //导入方法依赖的package包/类
public void testMethodToStringWithNullArg() throws Exception {
Invocation invocation = new Invocation(INVOKED, methodFactory.newMethod(METHOD_NAME, new Class[]{String.class}, void.class, EXCEPTION_TYPES),
new Object[]{null});
String result = invocation.toString();
AssertThat.stringIncludes("Should contain invokedMethod name", METHOD_NAME, result);
AssertThat.stringIncludes("Should contain firstArg", "null", result);
}