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


Java Times.unlimited方法代码示例

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


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

示例1: shouldRemoveMultipleExpiredExpectations

import org.mockserver.matchers.Times; //导入方法依赖的package包/类
@Test
public void shouldRemoveMultipleExpiredExpectations() throws InterruptedException {
    // when
    mockServerMatcher.add(new Expectation(httpRequest.withPath("somePath"), Times.unlimited(), TimeToLive.exactly(TimeUnit.MICROSECONDS, 0L)).thenRespond(httpResponse.withBody("someBody")));
    Expectation expectationToExpireAfter3Seconds = new Expectation(httpRequest.withPath("somePath"), Times.unlimited(), TimeToLive.exactly(TimeUnit.SECONDS, 3L));
    mockServerMatcher.add(expectationToExpireAfter3Seconds.thenRespond(httpResponse.withBody("someBody")));

    // then
    assertThat(mockServerMatcher.firstMatchingExpectation(new HttpRequest().withPath("somePath")), is(expectationToExpireAfter3Seconds));
    assertThat(mockServerMatcher.httpRequestMatchers.size(), is(1));

    // when
    TimeUnit.SECONDS.sleep(3);

    // then - after 3 seconds
    assertThat(mockServerMatcher.firstMatchingExpectation(new HttpRequest().withPath("someOtherPath")), nullValue());
    assertThat(mockServerMatcher.httpRequestMatchers, empty());
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:19,代码来源:MockServerMatcherManageExpectationsTest.java

示例2: buildObject

import org.mockserver.matchers.Times; //导入方法依赖的package包/类
public Times buildObject() {
    if (unlimited) {
        return Times.unlimited();
    } else {
        return Times.exactly(remainingTimes);
    }
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:8,代码来源:TimesDTO.java

示例3: Expectation

import org.mockserver.matchers.Times; //导入方法依赖的package包/类
public Expectation(HttpRequest httpRequest) {
    this(httpRequest, Times.unlimited(), TimeToLive.unlimited());
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:4,代码来源:Expectation.java

示例4: buildObject

import org.mockserver.matchers.Times; //导入方法依赖的package包/类
public Expectation buildObject() {
    HttpRequest httpRequest = null;
    HttpResponse httpResponse = null;
    HttpTemplate httpResponseTemplate = null;
    HttpClassCallback httpResponseClassCallback = null;
    HttpObjectCallback httpResponseObjectCallback = null;
    HttpForward httpForward = null;
    HttpTemplate httpForwardTemplate = null;
    HttpClassCallback httpForwardClassCallback = null;
    HttpObjectCallback httpForwardObjectCallback = null;
    HttpOverrideForwardedRequest httpOverrideForwardedRequest = null;
    HttpError httpError = null;
    Times times;
    TimeToLive timeToLive;
    if (this.httpRequest != null) {
        httpRequest = this.httpRequest.buildObject();
    }
    if (this.httpResponse != null) {
        httpResponse = this.httpResponse.buildObject();
    }
    if (this.httpResponseTemplate != null) {
        httpResponseTemplate = this.httpResponseTemplate.buildObject();
    }
    if (this.httpResponseClassCallback != null) {
        httpResponseClassCallback = this.httpResponseClassCallback.buildObject();
    }
    if (this.httpResponseObjectCallback != null) {
        httpResponseObjectCallback = this.httpResponseObjectCallback.buildObject();
    }
    if (this.httpForward != null) {
        httpForward = this.httpForward.buildObject();
    }
    if (this.httpForwardTemplate != null) {
        httpForwardTemplate = this.httpForwardTemplate.buildObject();
    }
    if (this.httpForwardClassCallback != null) {
        httpForwardClassCallback = this.httpForwardClassCallback.buildObject();
    }
    if (this.httpForwardObjectCallback != null) {
        httpForwardObjectCallback = this.httpForwardObjectCallback.buildObject();
    }
    if (this.httpOverrideForwardedRequest != null) {
        httpOverrideForwardedRequest = this.httpOverrideForwardedRequest.buildObject();
    }
    if (this.httpError != null) {
        httpError = this.httpError.buildObject();
    }
    if (this.times != null) {
        times = this.times.buildObject();
    } else {
        times = Times.unlimited();
    }
    if (this.timeToLive != null) {
        timeToLive = this.timeToLive.buildObject();
    } else {
        timeToLive = TimeToLive.unlimited();
    }
    return new Expectation(httpRequest, times, timeToLive)
        .thenRespond(httpResponse)
        .thenRespond(httpResponseTemplate)
        .thenRespond(httpResponseClassCallback)
        .thenRespond(httpResponseObjectCallback)
        .thenForward(httpForward)
        .thenForward(httpForwardTemplate)
        .thenForward(httpForwardClassCallback)
        .thenForward(httpForwardObjectCallback)
        .thenForward(httpOverrideForwardedRequest)
        .thenError(httpError);
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:70,代码来源:ExpectationDTO.java


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