Repository: wicket Updated Branches: refs/heads/master 17787f67a -> b310601e7
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. (cherry picked from commit 371d61362db84e89634b12e4e8db2aa56ad2ccae) Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b310601e Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b310601e Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b310601e Branch: refs/heads/master Commit: b310601e79c863570dd6d4196a5c7c2aa13d7cf7 Parents: 17787f6 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:07:58 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/b310601e/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 d92c683..5ac6a00 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:
