当前位置: 首页>>代码示例>>Java>>正文


Java Invocation.toString方法代码示例

本文整理汇总了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);
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:17,代码来源:InvocationTests.java

示例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);
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:13,代码来源:InvocationTests.java

示例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);
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:10,代码来源:InvocationTests.java

示例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);
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:10,代码来源:InvocationTests.java

示例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);
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:9,代码来源:InvocationTests.java


注:本文中的org.jmock.api.Invocation.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。