Add ListBodySpec.size implementation

Added implementation for WebTestClient.ListBodySpec.size().
This commit is contained in:
Arjen Poutsma 2017-02-21 11:24:44 +01:00
parent 262e5f783d
commit 8450c69497
1 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
@ -429,6 +430,9 @@ class DefaultWebTestClient implements WebTestClient {
@Override
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;
}