|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -56,7 +56,7 @@ class StatusAssertionTests {
@@ -56,7 +56,7 @@ class StatusAssertionTests {
|
|
|
|
|
assertions.isEqualTo(408)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // gh-23630
|
|
|
|
|
@Test // gh-23630
|
|
|
|
|
void isEqualToWithCustomStatus() { |
|
|
|
|
statusAssertions(600).isEqualTo(600); |
|
|
|
|
} |
|
|
|
|
@ -74,20 +74,19 @@ class StatusAssertionTests {
@@ -74,20 +74,19 @@ class StatusAssertionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void statusSerius1xx() { |
|
|
|
|
void statusSeries1xx() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.CONTINUE); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
assertions.is1xxInformational(); |
|
|
|
|
|
|
|
|
|
// Wrong series
|
|
|
|
|
|
|
|
|
|
assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> |
|
|
|
|
assertions.is2xxSuccessful()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void statusSerius2xx() { |
|
|
|
|
void statusSeries2xx() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.OK); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
@ -99,7 +98,7 @@ class StatusAssertionTests {
@@ -99,7 +98,7 @@ class StatusAssertionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void statusSerius3xx() { |
|
|
|
|
void statusSeries3xx() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.PERMANENT_REDIRECT); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
@ -111,7 +110,7 @@ class StatusAssertionTests {
@@ -111,7 +110,7 @@ class StatusAssertionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void statusSerius4xx() { |
|
|
|
|
void statusSeries4xx() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
@ -123,7 +122,7 @@ class StatusAssertionTests {
@@ -123,7 +122,7 @@ class StatusAssertionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void statusSerius5xx() { |
|
|
|
|
void statusSeries5xx() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.INTERNAL_SERVER_ERROR); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
@ -135,7 +134,7 @@ class StatusAssertionTests {
@@ -135,7 +134,7 @@ class StatusAssertionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void matches() { |
|
|
|
|
void matchesStatusValue() { |
|
|
|
|
StatusAssertions assertions = statusAssertions(HttpStatus.CONFLICT); |
|
|
|
|
|
|
|
|
|
// Success
|
|
|
|
|
@ -147,11 +146,12 @@ class StatusAssertionTests {
@@ -147,11 +146,12 @@ class StatusAssertionTests {
|
|
|
|
|
assertions.value(equalTo(200))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void matchesWithCustomStatus() { |
|
|
|
|
@Test // gh-26658
|
|
|
|
|
void matchesCustomStatusValue() { |
|
|
|
|
statusAssertions(600).value(equalTo(600)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private StatusAssertions statusAssertions(HttpStatus status) { |
|
|
|
|
return statusAssertions(status.value()); |
|
|
|
|
} |
|
|
|
|
|