Repository: wicket Updated Branches: refs/heads/wicket-7.x 91da6e5dc -> 371d61362
WICKET-6397 WicketTester should take resulting HTTP status into account Add a sentence that WicketTester#getLastResponse() should be used to get any information in the HTTP response. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/371d6136 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/371d6136 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/371d6136 Branch: refs/heads/wicket-7.x Commit: 371d61362db84e89634b12e4e8db2aa56ad2ccae Parents: 91da6e5 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Mon Jun 19 22:06:44 2017 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Mon Jun 19 22:06:44 2017 +0200 ---------------------------------------------------------------------- wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/371d6136/wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc b/wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc index 200820e..d896f4b 100644 --- a/wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc +++ b/wicket-user-guide/src/main/asciidoc/testing/testing_1.adoc @@ -120,7 +120,7 @@ If test requires a page we can use _startComponentInPage(Component)_ which autom === Testing the response -_WicketTester_ allows us to access to the last response generated during testing with method _getLastResponse_. The returned value is an instance of class MockHttpServletResponse that provides helper methods to extract informations from mocked request. +_WicketTester_ allows us to access to the last response generated during testing with method _getLastResponse()_. The returned value is an instance of class MockHttpServletResponse that provides helper methods to extract information from mocked request. In the test case from project _CustomResourceMounting_ we extract the text contained in the last response with method _getDocument_ and we check if it is equal to the RSS feed used for the test: @@ -144,6 +144,8 @@ public void testMountedResourceResponse() throws IOException, FeedException{test To simulate a request to the custom resource we used method _startResource_ which can be used also with resource references. +_getLastResponse()_ should be used to assert the status code, response headers, binary content and anything that is part of the HTTP response. + === Testing URLs _WicketTester_ can be pointed to an arbitrary URL with method _executeUrl(String url)_. This can be useful to test mounted pages, resources or request mappers:
