use of org.mockserver.verify.VerificationTimes in project mockserver by mock-server.
the class VerificationDTOTest method shouldReturnValuesSetInConstructor.
@Test
public void shouldReturnValuesSetInConstructor() {
// given
HttpRequest request = request();
VerificationTimes times = VerificationTimes.atLeast(1);
Verification verification = verification().withRequest(request).withTimes(times);
// when
VerificationDTO verificationDTO = new VerificationDTO(verification);
// then
assertThat(verificationDTO.getHttpRequest(), is(new HttpRequestDTO(request)));
assertThat(verificationDTO.getTimes(), is(new VerificationTimesDTO(times)));
}
use of org.mockserver.verify.VerificationTimes in project mockserver by mock-server.
the class VerificationTimesDTOTest method shouldBuildCorrectObject.
@Test
public void shouldBuildCorrectObject() {
// when
VerificationTimes times = new VerificationTimesDTO(VerificationTimes.never()).buildObject();
// then
assertThat(times.getAtLeast(), is(0));
assertThat(times.getAtMost(), is(0));
// when
times = new VerificationTimesDTO(VerificationTimes.once()).buildObject();
// then
assertThat(times.getAtLeast(), is(1));
assertThat(times.getAtMost(), is(1));
// when
times = new VerificationTimesDTO(VerificationTimes.exactly(2)).buildObject();
// then
assertThat(times.getAtLeast(), is(2));
assertThat(times.getAtMost(), is(2));
// when
times = new VerificationTimesDTO(VerificationTimes.atLeast(3)).buildObject();
// then
assertThat(times.getAtLeast(), is(3));
assertThat(times.getAtMost(), is(-1));
// when
times = new VerificationTimesDTO(VerificationTimes.atMost(4)).buildObject();
// then
assertThat(times.getAtLeast(), is(-1));
assertThat(times.getAtMost(), is(4));
}
use of org.mockserver.verify.VerificationTimes in project mockserver by mock-server.
the class VerificationTimesTest method shouldCreateCorrectObjectForAtLeast.
@Test
public void shouldCreateCorrectObjectForAtLeast() {
// when
VerificationTimes times = atLeast(2);
// then
assertThat(times.getAtLeast(), is(2));
assertThat(times.getAtMost(), is(-1));
}
use of org.mockserver.verify.VerificationTimes in project mockserver by mock-server.
the class VerificationTimesTest method shouldMatchAtMostZeroCorrectly.
@Test
public void shouldMatchAtMostZeroCorrectly() {
// when
VerificationTimes times = atMost(0);
// then
assertThat(times.matches(0), is(true));
assertThat(times.matches(1), is(false));
assertThat(times.matches(2), is(false));
assertThat(times.matches(3), is(false));
}
use of org.mockserver.verify.VerificationTimes in project mockserver by mock-server.
the class VerificationTimesTest method shouldCreateCorrectObjectForAtMost.
@Test
public void shouldCreateCorrectObjectForAtMost() {
// when
VerificationTimes times = atMost(2);
// then
assertThat(times.getAtLeast(), is(-1));
assertThat(times.getAtMost(), is(2));
}
Aggregations