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


Java VerificationModeFactory.times方法代码示例

本文整理汇总了Java中org.mockito.internal.verification.VerificationModeFactory.times方法的典型用法代码示例。如果您正苦于以下问题:Java VerificationModeFactory.times方法的具体用法?Java VerificationModeFactory.times怎么用?Java VerificationModeFactory.times使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mockito.internal.verification.VerificationModeFactory的用法示例。


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

示例1: oneTimeOnly

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
public static VerificationMode oneTimeOnly() {
    return VerificationModeFactory.times(1);
}
 
开发者ID:ubiratansoares,项目名称:reactive-architectures-playground,代码行数:4,代码来源:MockitoHelpers.java

示例2: never

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
public VerificationMode never() {
    return new Timeout(impl.getTreshhold(), impl.getTimeout(), VerificationModeFactory.times(0));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:Timeout.java

示例3: shouldNotAllowNegativeNumberOfInvocations

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
@Test
public void shouldNotAllowNegativeNumberOfInvocations() throws Exception {
    try {
        VerificationModeFactory.times(-50);
        fail();
    } catch (MockitoException e) {
        assertEquals("Negative value is not allowed here", e.getMessage());
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TimesTest.java

示例4: times

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
public VerificationMode times(int wantedNumberOfInvocations) {
    return new Timeout(impl.getTreshhold(), impl.getTimeout(), VerificationModeFactory.times(wantedNumberOfInvocations));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:Timeout.java

示例5: inOrder

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
public Times inOrder() {
    return VerificationModeFactory.times(times);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:VerificationModeBuilder.java

示例6: shouldStartVerificationAndPullVerificationMode

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
@Test
public void shouldStartVerificationAndPullVerificationMode() throws Exception {
    assertNull(mockingProgress.pullVerificationMode());
    
    VerificationMode mode = VerificationModeFactory.times(19);
    
    mockingProgress.verificationStarted(mode);
    
    assertSame(mode, mockingProgress.pullVerificationMode());
    
    assertNull(mockingProgress.pullVerificationMode());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:MockingProgressImplTest.java

示例7: times

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
/**
 * Allows verifying exact number of invocations. E.g:
 * <pre>
 *   verify(mock, times(2)).someMethod("some arg");
 * </pre>
 * 
 * See examples in javadoc for {@link Mockito} class
 * 
 * @param wantedNumberOfInvocations wanted number of invocations 
 * 
 * @return verification mode
 */
public static VerificationMode times(int wantedNumberOfInvocations) {
    return VerificationModeFactory.times(wantedNumberOfInvocations);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:Mockito.java

示例8: timeout

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
/**
 * Allows verifying with timeout. May be useful for testing in concurrent conditions.
 * <p>
 * It feels this feature should be used rarely - figure out a better way of testing your multi-threaded system
 * <p>
 * Not yet implemented to work with InOrder verification.
 * <pre>
 *   //passes when someMethod() is called within given time span 
 *   verify(mock, timeout(100)).someMethod();
 *   //above is an alias to:
 *   verify(mock, timeout(100).times(1)).someMethod();
 *   
 *   //passes when someMethod() is called *exactly* 2 times within given time span
 *   verify(mock, timeout(100).times(2)).someMethod();
 *
 *   //passes when someMethod() is called *at lest* 2 times within given time span
 *   verify(mock, timeout(100).atLeast(2)).someMethod();
 *   
 *   //verifies someMethod() within given time span using given verification mode
 *   //useful only if you have your own custom verification modes.
 *   verify(mock, new Timeout(100, yourOwnVerificationMode)).someMethod();
 * </pre>
 * 
 * See examples in javadoc for {@link Mockito} class
 * 
 * @param millis - time span in millis
 * 
 * @return verification mode
 */
public static VerificationWithTimeout timeout(int millis) {
    return new Timeout(millis, VerificationModeFactory.times(1));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:33,代码来源:Mockito.java

示例9: times

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
/**
 * Allows verifying exact number of invocations. E.g:
 * <pre class="code"><code class="java">
 *   verify(mock, times(2)).someMethod("some arg");
 * </code></pre>
 * 
 * See examples in javadoc for {@link Mockito} class
 * 
 * @param wantedNumberOfInvocations wanted number of invocations 
 * 
 * @return verification mode
 */
public static VerificationMode times(int wantedNumberOfInvocations) {
    return VerificationModeFactory.times(wantedNumberOfInvocations);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:Mockito.java

示例10: timeout

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
/**
 * Allows verifying with timeout. It causes a verify to wait for a specified period of time for a desired
 * interaction rather than fails immediately if has not already happened. May be useful for testing in concurrent
 * conditions.
 * <p>
 * This differs from {@link Mockito#after after()} in that after() will wait the full period, unless
 * the final test result is known early (e.g. if a never() fails), whereas timeout() will stop early as soon
 * as verification passes, producing different behaviour when used with times(2), for example, which can pass 
 * and then later fail. In that case, timeout would pass as soon as times(2) passes, whereas after would run until
 * times(2) failed, and then fail.
 * <p>
 * It feels this feature should be used rarely - figure out a better way of testing your multi-threaded system
 * <p>
 * Not yet implemented to work with InOrder verification.
 * <pre class="code"><code class="java">
 *   //passes when someMethod() is called within given time span 
 *   verify(mock, timeout(100)).someMethod();
 *   //above is an alias to:
 *   verify(mock, timeout(100).times(1)).someMethod();
 *   
 *   //passes as soon as someMethod() has been called 2 times before the given timeout
 *   verify(mock, timeout(100).times(2)).someMethod();
 *
 *   //equivalent: this also passes as soon as someMethod() has been called 2 times before the given timeout
 *   verify(mock, timeout(100).atLeast(2)).someMethod();
 *   
 *   //verifies someMethod() within given time span using given verification mode
 *   //useful only if you have your own custom verification modes.
 *   verify(mock, new Timeout(100, yourOwnVerificationMode)).someMethod();
 * </code></pre>
 * 
 * See examples in javadoc for {@link Mockito} class
 * 
 * @param millis - time span in milliseconds
 * 
 * @return verification mode
 */
public static VerificationWithTimeout timeout(int millis) {
    return new Timeout(millis, VerificationModeFactory.times(1));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:41,代码来源:Mockito.java

示例11: after

import org.mockito.internal.verification.VerificationModeFactory; //导入方法依赖的package包/类
/**
 * Allows verifying over a given period. It causes a verify to wait for a specified period of time for a desired
 * interaction rather than failing immediately if has not already happened. May be useful for testing in concurrent
 * conditions.
 * <p>
 * This differs from {@link Mockito#timeout timeout()} in that after() will wait the full period, whereas timeout() 
 * will stop early as soon as verification passes, producing different behaviour when used with times(2), for example,
 * which can pass and then later fail. In that case, timeout would pass as soon as times(2) passes, whereas after would
 * run the full time, which point it will fail, as times(2) has failed.
 * <p>
 * It feels this feature should be used rarely - figure out a better way of testing your multi-threaded system
 * <p>
 * Not yet implemented to work with InOrder verification.
 * <pre class="code"><code class="java">
 *   //passes after 100ms, if someMethod() has only been called once at that time. 
 *   verify(mock, after(100)).someMethod();
 *   //above is an alias to:
 *   verify(mock, after(100).times(1)).someMethod();
 *   
 *   //passes if someMethod() is called <b>*exactly*</b> 2 times after the given timespan
 *   verify(mock, after(100).times(2)).someMethod();
 *
 *   //passes if someMethod() has not been called after the given timespan
 *   verify(mock, after(100).never()).someMethod();
 *   
 *   //verifies someMethod() after a given time span using given verification mode
 *   //useful only if you have your own custom verification modes.
 *   verify(mock, new After(100, yourOwnVerificationMode)).someMethod();
 * </code></pre>
 * 
 * See examples in javadoc for {@link Mockito} class
 * 
 * @param millis - time span in milliseconds
 * 
 * @return verification mode
 */
public static VerificationAfterDelay after(int millis) {
    return new After(millis, VerificationModeFactory.times(1));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:40,代码来源:Mockito.java


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