本文整理汇总了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());
}
示例2: buildObject
import org.mockserver.matchers.Times; //导入方法依赖的package包/类
public Times buildObject() {
if (unlimited) {
return Times.unlimited();
} else {
return Times.exactly(remainingTimes);
}
}
示例3: Expectation
import org.mockserver.matchers.Times; //导入方法依赖的package包/类
public Expectation(HttpRequest httpRequest) {
this(httpRequest, Times.unlimited(), TimeToLive.unlimited());
}
示例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);
}