Introduce constants for common attribute names

Closes gh-193
This commit is contained in:
Andy Wilkinson
2016-02-05 20:57:46 +00:00
parent 6df01419cd
commit 83b72f7962
14 changed files with 89 additions and 57 deletions

View File

@@ -24,6 +24,7 @@ import org.junit.Test;
import org.springframework.http.HttpMethod;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockServletContext;
import org.springframework.restdocs.generate.RestDocumentationGenerator;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -143,7 +144,8 @@ public class RestDocumentationRequestBuildersTests {
HttpMethod httpMethod) {
MockHttpServletRequest request = builder.buildRequest(this.servletContext);
assertThat(
(String) request.getAttribute("org.springframework.restdocs.urlTemplate"),
(String) request
.getAttribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE),
is(equalTo("{template}")));
assertThat(request.getRequestURI(), is(equalTo("t")));
assertThat(request.getMethod(), is(equalTo(httpMethod.name())));