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


Java Same类代码示例

本文整理汇总了Java中org.mockito.internal.matchers.Same的典型用法代码示例。如果您正苦于以下问题:Java Same类的具体用法?Java Same怎么用?Java Same使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Same类属于org.mockito.internal.matchers包,在下文中一共展示了Same类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyPersist

import org.mockito.internal.matchers.Same; //导入依赖的package包/类
private void verifyPersist(Object message) throws Exception {
    verifyPersist(message, new Same(message), true);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:4,代码来源:ReplicatedLogImplTest.java

示例2: subCall

import org.mockito.internal.matchers.Same; //导入依赖的package包/类
@Test
    public void subCall()
    {
        Tracer tracer = mock(Tracer.class);
        InProcessExecutable victim = new InProcessExecutable(tracer);

        ExecutionContext ctx = mock(ExecutionContext.class);
        OperationKey expectedOp = new OperationKey(new ServiceVersion(1,0),"Wibble","wobble");
        OperationKey op = new OperationKey(expectedOp, "_IN_PROCESS");
        Object[] args = new Object[1];
        ExecutionObserver obs = mock(ExecutionObserver.class);
        ExecutionVenue venue = mock(ExecutionVenue.class);
        TimeConstraints constraints = mock(TimeConstraints.class);

        RequestUUID parentUuid = new RequestUUIDImpl();
        when(ctx.getRequestUUID()).thenReturn(parentUuid);
        when(ctx.isTransportSecure()).thenReturn(false);
        IdentityChain mockIdentityChain = new IdentityChainImpl();
        when(ctx.getIdentity()).thenReturn(mockIdentityChain);
        GeoLocationDetails mockLocation = mock(GeoLocationDetails.class);
        when(ctx.getLocation()).thenReturn(mockLocation);
        when(ctx.getReceivedTime()).thenReturn(new Date(0L));
        when(ctx.getRequestTime()).thenReturn(new Date(0L));
        when(ctx.getTransportSecurityStrengthFactor()).thenReturn(0);


        victim.execute(ctx, op, args, obs, venue, constraints);

        ArgumentCaptor<ExecutionContext> arg1 = ArgumentCaptor.forClass(ExecutionContext.class);
        ArgumentCaptor<OperationKey> arg2 = ArgumentCaptor.forClass(OperationKey.class);
        ArgumentCaptor<Object[]> arg3 = ArgumentCaptor.forClass(Object[].class);
        ArgumentCaptor<ExecutionObserver> arg4 = ArgumentCaptor.forClass(ExecutionObserver.class);
        ArgumentCaptor<TimeConstraints> arg5 = ArgumentCaptor.forClass(TimeConstraints.class);

        // moved from this as it was failing and v hard to work out which bit was failing
//        verify(venue, times(1)).execute(argThat(isSubContextOf(ctx)),eq(new OperationKey(op, null)),same(args),
//                argThat(isTracingEndObserver(obs, parentUuid, op, tracer)),same(constraints));

        verify(venue, times(1)).execute(arg1.capture(), arg2.capture(), arg3.capture(), arg4.capture(), arg5.capture());

        assertThat(arg1.getValue(), isSubContextOf(ctx));
        assertThat(arg2.getValue(), new Equals(expectedOp));
        assertThat(arg3.getValue(), new Same(args));
        assertThat(arg4.getValue(), isTracingEndObserver(obs, parentUuid, expectedOp, tracer));
        assertThat(arg5.getValue(), new Same(constraints));
    }
 
开发者ID:betfair,项目名称:cougar,代码行数:47,代码来源:InProcessExecutableTest.java


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