Add ListBodySpec.size implementation
Added implementation for WebTestClient.ListBodySpec.size().
This commit is contained in:
parent
262e5f783d
commit
8450c69497
|
|
@ -13,6 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.test.web.reactive.server;
|
package org.springframework.test.web.reactive.server;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
@ -429,6 +430,9 @@ class DefaultWebTestClient implements WebTestClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListBodySpec hasSize(int size) {
|
public ListBodySpec hasSize(int size) {
|
||||||
|
List<?> actual = this.result.getResponseBody();
|
||||||
|
String message = "Response body does not contain " + size + " elements";
|
||||||
|
this.result.assertWithDiagnostics(() -> assertEquals(message, size, actual.size()));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue