Replace space indentation with tabs

Issue: SPR-10127
This commit is contained in:
Phillip Webb
2012-12-19 14:55:41 -08:00
committed by Chris Beams
parent 1762157ad1
commit 2cf45bad86
154 changed files with 1481 additions and 1476 deletions

View File

@@ -37,7 +37,7 @@ public abstract class MatcherAssertionErrors {
private MatcherAssertionErrors() {
}
}
/**
* Asserts that the given matcher matches the actual value.
@@ -65,8 +65,8 @@ public abstract class MatcherAssertionErrors {
description.appendText("\nExpected: ");
description.appendDescriptionOf(matcher);
if (describeMismatchMethod != null) {
description.appendText("\n but: ");
matcher.describeMismatch(actual, description);
description.appendText("\n but: ");
matcher.describeMismatch(actual, description);
}
else {
description.appendText("\n got: ");

View File

@@ -22,6 +22,6 @@ public interface RequestBuilder {
* @param servletContext the {@link ServletContext} to use to create the request
* @return the request
*/
MockHttpServletRequest buildRequest(ServletContext servletContext);
MockHttpServletRequest buildRequest(ServletContext servletContext);
}

View File

@@ -86,461 +86,461 @@ public class StatusResultMatchers {
};
}
/**
* Assert the response status code is {@code HttpStatus.CONTINUE} (100).
*/
public ResultMatcher isContinue() {
return matcher(HttpStatus.CONTINUE);
}
/**
* Assert the response status code is {@code HttpStatus.SWITCHING_PROTOCOLS} (101).
*/
public ResultMatcher isSwitchingProtocols() {
return matcher(HttpStatus.SWITCHING_PROTOCOLS);
}
/**
* Assert the response status code is {@code HttpStatus.PROCESSING} (102).
*/
public ResultMatcher isProcessing() {
return matcher(HttpStatus.PROCESSING);
}
/**
* Assert the response status code is {@code HttpStatus.CHECKPOINT} (103).
*/
public ResultMatcher isCheckpoint() {
return matcher(HttpStatus.valueOf(103));
}
/**
* Assert the response status code is {@code HttpStatus.OK} (200).
*/
public ResultMatcher isOk() {
return matcher(HttpStatus.OK);
}
/**
* Assert the response status code is {@code HttpStatus.CREATED} (201).
*/
public ResultMatcher isCreated() {
return matcher(HttpStatus.CREATED);
}
/**
* Assert the response status code is {@code HttpStatus.ACCEPTED} (202).
*/
public ResultMatcher isAccepted() {
return matcher(HttpStatus.ACCEPTED);
}
/**
* Assert the response status code is {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION} (203).
*/
public ResultMatcher isNonAuthoritativeInformation() {
return matcher(HttpStatus.NON_AUTHORITATIVE_INFORMATION);
}
/**
* Assert the response status code is {@code HttpStatus.NO_CONTENT} (204).
*/
public ResultMatcher isNoContent() {
return matcher(HttpStatus.NO_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.RESET_CONTENT} (205).
*/
public ResultMatcher isResetContent() {
return matcher(HttpStatus.RESET_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.PARTIAL_CONTENT} (206).
*/
public ResultMatcher isPartialContent() {
return matcher(HttpStatus.PARTIAL_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.MULTI_STATUS} (207).
*/
public ResultMatcher isMultiStatus() {
return matcher(HttpStatus.MULTI_STATUS);
}
/**
* Assert the response status code is {@code HttpStatus.ALREADY_REPORTED} (208).
*/
public ResultMatcher isAlreadyReported() {
return matcher(HttpStatus.ALREADY_REPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.IM_USED} (226).
*/
public ResultMatcher isImUsed() {
return matcher(HttpStatus.IM_USED);
}
/**
* Assert the response status code is {@code HttpStatus.MULTIPLE_CHOICES} (300).
*/
public ResultMatcher isMultipleChoices() {
return matcher(HttpStatus.MULTIPLE_CHOICES);
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_PERMANENTLY} (301).
*/
public ResultMatcher isMovedPermanently() {
return matcher(HttpStatus.MOVED_PERMANENTLY);
}
/**
* Assert the response status code is {@code HttpStatus.FOUND} (302).
*/
public ResultMatcher isFound() {
return matcher(HttpStatus.FOUND);
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302).
*/
public ResultMatcher isMovedTemporarily() {
return matcher(HttpStatus.MOVED_TEMPORARILY);
}
/**
* Assert the response status code is {@code HttpStatus.SEE_OTHER} (303).
*/
public ResultMatcher isSeeOther() {
return matcher(HttpStatus.SEE_OTHER);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_MODIFIED} (304).
*/
public ResultMatcher isNotModified() {
return matcher(HttpStatus.NOT_MODIFIED);
}
/**
* Assert the response status code is {@code HttpStatus.USE_PROXY} (305).
*/
public ResultMatcher isUseProxy() {
return matcher(HttpStatus.USE_PROXY);
}
/**
* Assert the response status code is {@code HttpStatus.TEMPORARY_REDIRECT} (307).
*/
public ResultMatcher isTemporaryRedirect() {
return matcher(HttpStatus.TEMPORARY_REDIRECT);
}
/**
* Assert the response status code is {@code HttpStatus.RESUME_INCOMPLETE} (308).
*/
public ResultMatcher isResumeIncomplete() {
return matcher(HttpStatus.valueOf(308));
}
/**
* Assert the response status code is {@code HttpStatus.BAD_REQUEST} (400).
*/
public ResultMatcher isBadRequest() {
return matcher(HttpStatus.BAD_REQUEST);
}
/**
* Assert the response status code is {@code HttpStatus.UNAUTHORIZED} (401).
*/
public ResultMatcher isUnauthorized() {
return matcher(HttpStatus.UNAUTHORIZED);
}
/**
* Assert the response status code is {@code HttpStatus.PAYMENT_REQUIRED} (402).
*/
public ResultMatcher isPaymentRequired() {
return matcher(HttpStatus.PAYMENT_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.FORBIDDEN} (403).
*/
public ResultMatcher isForbidden() {
return matcher(HttpStatus.FORBIDDEN);
}
/**
* Assert the response status code is {@code HttpStatus.CONTINUE} (100).
*/
public ResultMatcher isContinue() {
return matcher(HttpStatus.CONTINUE);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_FOUND} (404).
*/
public ResultMatcher isNotFound() {
return matcher(HttpStatus.NOT_FOUND);
}
* Assert the response status code is {@code HttpStatus.SWITCHING_PROTOCOLS} (101).
*/
public ResultMatcher isSwitchingProtocols() {
return matcher(HttpStatus.SWITCHING_PROTOCOLS);
}
/**
* Assert the response status code is {@code HttpStatus.METHOD_NOT_ALLOWED} (405).
*/
public ResultMatcher isMethodNotAllowed() {
return matcher(HttpStatus.METHOD_NOT_ALLOWED);
}
/**
* Assert the response status code is {@code HttpStatus.PROCESSING} (102).
*/
public ResultMatcher isProcessing() {
return matcher(HttpStatus.PROCESSING);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_ACCEPTABLE} (406).
*/
public ResultMatcher isNotAcceptable() {
return matcher(HttpStatus.NOT_ACCEPTABLE);
}
/**
* Assert the response status code is {@code HttpStatus.CHECKPOINT} (103).
*/
public ResultMatcher isCheckpoint() {
return matcher(HttpStatus.valueOf(103));
}
/**
* Assert the response status code is {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED} (407).
*/
public ResultMatcher isProxyAuthenticationRequired() {
return matcher(HttpStatus.PROXY_AUTHENTICATION_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.OK} (200).
*/
public ResultMatcher isOk() {
return matcher(HttpStatus.OK);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_TIMEOUT} (408).
*/
public ResultMatcher isRequestTimeout() {
return matcher(HttpStatus.REQUEST_TIMEOUT);
}
/**
* Assert the response status code is {@code HttpStatus.CREATED} (201).
*/
public ResultMatcher isCreated() {
return matcher(HttpStatus.CREATED);
}
/**
* Assert the response status code is {@code HttpStatus.CONFLICT} (409).
*/
public ResultMatcher isConflict() {
return matcher(HttpStatus.CONFLICT);
}
/**
* Assert the response status code is {@code HttpStatus.ACCEPTED} (202).
*/
public ResultMatcher isAccepted() {
return matcher(HttpStatus.ACCEPTED);
}
/**
* Assert the response status code is {@code HttpStatus.GONE} (410).
*/
public ResultMatcher isGone() {
return matcher(HttpStatus.GONE);
}
/**
* Assert the response status code is {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION} (203).
*/
public ResultMatcher isNonAuthoritativeInformation() {
return matcher(HttpStatus.NON_AUTHORITATIVE_INFORMATION);
}
/**
* Assert the response status code is {@code HttpStatus.LENGTH_REQUIRED} (411).
*/
public ResultMatcher isLengthRequired() {
return matcher(HttpStatus.LENGTH_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.NO_CONTENT} (204).
*/
public ResultMatcher isNoContent() {
return matcher(HttpStatus.NO_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.PRECONDITION_FAILED} (412).
*/
public ResultMatcher isPreconditionFailed() {
return matcher(HttpStatus.PRECONDITION_FAILED);
}
/**
* Assert the response status code is {@code HttpStatus.RESET_CONTENT} (205).
*/
public ResultMatcher isResetContent() {
return matcher(HttpStatus.RESET_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413).
*/
public ResultMatcher isRequestEntityTooLarge() {
return matcher(HttpStatus.REQUEST_ENTITY_TOO_LARGE);
}
/**
* Assert the response status code is {@code HttpStatus.PARTIAL_CONTENT} (206).
*/
public ResultMatcher isPartialContent() {
return matcher(HttpStatus.PARTIAL_CONTENT);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414).
*/
public ResultMatcher isRequestUriTooLong() {
return matcher(HttpStatus.REQUEST_URI_TOO_LONG);
}
/**
* Assert the response status code is {@code HttpStatus.MULTI_STATUS} (207).
*/
public ResultMatcher isMultiStatus() {
return matcher(HttpStatus.MULTI_STATUS);
}
/**
* Assert the response status code is {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE} (415).
*/
public ResultMatcher isUnsupportedMediaType() {
return matcher(HttpStatus.UNSUPPORTED_MEDIA_TYPE);
}
/**
* Assert the response status code is {@code HttpStatus.ALREADY_REPORTED} (208).
*/
public ResultMatcher isAlreadyReported() {
return matcher(HttpStatus.ALREADY_REPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE} (416).
*/
public ResultMatcher isRequestedRangeNotSatisfiable() {
return matcher(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE);
}
/**
* Assert the response status code is {@code HttpStatus.IM_USED} (226).
*/
public ResultMatcher isImUsed() {
return matcher(HttpStatus.IM_USED);
}
/**
* Assert the response status code is {@code HttpStatus.EXPECTATION_FAILED} (417).
*/
public ResultMatcher isExpectationFailed() {
return matcher(HttpStatus.EXPECTATION_FAILED);
}
/**
* Assert the response status code is {@code HttpStatus.MULTIPLE_CHOICES} (300).
*/
public ResultMatcher isMultipleChoices() {
return matcher(HttpStatus.MULTIPLE_CHOICES);
}
/**
* Assert the response status code is {@code HttpStatus.I_AM_A_TEAPOT} (418).
*/
public ResultMatcher isIAmATeapot() {
return matcher(HttpStatus.valueOf(418));
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_PERMANENTLY} (301).
*/
public ResultMatcher isMovedPermanently() {
return matcher(HttpStatus.MOVED_PERMANENTLY);
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} (419).
* @deprecated matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
*/
public ResultMatcher isInsufficientSpaceOnResource() {
return matcher(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE);
}
/**
* Assert the response status code is {@code HttpStatus.FOUND} (302).
*/
public ResultMatcher isFound() {
return matcher(HttpStatus.FOUND);
}
/**
* Assert the response status code is {@code HttpStatus.METHOD_FAILURE} (420).
* @deprecated matching the deprecation of HttpStatus.METHOD_FAILURE
*/
public ResultMatcher isMethodFailure() {
return matcher(HttpStatus.METHOD_FAILURE);
}
/**
* Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302).
*/
public ResultMatcher isMovedTemporarily() {
return matcher(HttpStatus.MOVED_TEMPORARILY);
}
/**
* Assert the response status code is {@code HttpStatus.DESTINATION_LOCKED} (421).
* @deprecated matching the deprecation of HttpStatus.DESTINATION_LOCKED
*/
public ResultMatcher isDestinationLocked() {
return matcher(HttpStatus.DESTINATION_LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.SEE_OTHER} (303).
*/
public ResultMatcher isSeeOther() {
return matcher(HttpStatus.SEE_OTHER);
}
/**
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_ENTITY} (422).
*/
public ResultMatcher isUnprocessableEntity() {
return matcher(HttpStatus.UNPROCESSABLE_ENTITY);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_MODIFIED} (304).
*/
public ResultMatcher isNotModified() {
return matcher(HttpStatus.NOT_MODIFIED);
}
/**
* Assert the response status code is {@code HttpStatus.LOCKED} (423).
*/
public ResultMatcher isLocked() {
return matcher(HttpStatus.LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.USE_PROXY} (305).
*/
public ResultMatcher isUseProxy() {
return matcher(HttpStatus.USE_PROXY);
}
/**
* Assert the response status code is {@code HttpStatus.FAILED_DEPENDENCY} (424).
*/
public ResultMatcher isFailedDependency() {
return matcher(HttpStatus.FAILED_DEPENDENCY);
}
/**
* Assert the response status code is {@code HttpStatus.TEMPORARY_REDIRECT} (307).
*/
public ResultMatcher isTemporaryRedirect() {
return matcher(HttpStatus.TEMPORARY_REDIRECT);
}
/**
* Assert the response status code is {@code HttpStatus.UPGRADE_REQUIRED} (426).
*/
public ResultMatcher isUpgradeRequired() {
return matcher(HttpStatus.UPGRADE_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.RESUME_INCOMPLETE} (308).
*/
public ResultMatcher isResumeIncomplete() {
return matcher(HttpStatus.valueOf(308));
}
/**
* Assert the response status code is {@code HttpStatus.PRECONDITION_REQUIRED} (428).
*/
public ResultMatcher isPreconditionRequired() {
return matcher(HttpStatus.valueOf(428));
}
/**
* Assert the response status code is {@code HttpStatus.BAD_REQUEST} (400).
*/
public ResultMatcher isBadRequest() {
return matcher(HttpStatus.BAD_REQUEST);
}
/**
* Assert the response status code is {@code HttpStatus.TOO_MANY_REQUESTS} (429).
*/
public ResultMatcher isTooManyRequests() {
return matcher(HttpStatus.valueOf(429));
}
/**
* Assert the response status code is {@code HttpStatus.UNAUTHORIZED} (401).
*/
public ResultMatcher isUnauthorized() {
return matcher(HttpStatus.UNAUTHORIZED);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE} (431).
*/
public ResultMatcher isRequestHeaderFieldsTooLarge() {
return matcher(HttpStatus.valueOf(431));
}
/**
* Assert the response status code is {@code HttpStatus.PAYMENT_REQUIRED} (402).
*/
public ResultMatcher isPaymentRequired() {
return matcher(HttpStatus.PAYMENT_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.INTERNAL_SERVER_ERROR} (500).
*/
public ResultMatcher isInternalServerError() {
return matcher(HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
* Assert the response status code is {@code HttpStatus.FORBIDDEN} (403).
*/
public ResultMatcher isForbidden() {
return matcher(HttpStatus.FORBIDDEN);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_IMPLEMENTED} (501).
*/
public ResultMatcher isNotImplemented() {
return matcher(HttpStatus.NOT_IMPLEMENTED);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_FOUND} (404).
*/
public ResultMatcher isNotFound() {
return matcher(HttpStatus.NOT_FOUND);
}
/**
* Assert the response status code is {@code HttpStatus.BAD_GATEWAY} (502).
*/
public ResultMatcher isBadGateway() {
return matcher(HttpStatus.BAD_GATEWAY);
}
/**
* Assert the response status code is {@code HttpStatus.METHOD_NOT_ALLOWED} (405).
*/
public ResultMatcher isMethodNotAllowed() {
return matcher(HttpStatus.METHOD_NOT_ALLOWED);
}
/**
* Assert the response status code is {@code HttpStatus.SERVICE_UNAVAILABLE} (503).
*/
public ResultMatcher isServiceUnavailable() {
return matcher(HttpStatus.SERVICE_UNAVAILABLE);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_ACCEPTABLE} (406).
*/
public ResultMatcher isNotAcceptable() {
return matcher(HttpStatus.NOT_ACCEPTABLE);
}
/**
* Assert the response status code is {@code HttpStatus.GATEWAY_TIMEOUT} (504).
*/
public ResultMatcher isGatewayTimeout() {
return matcher(HttpStatus.GATEWAY_TIMEOUT);
}
/**
* Assert the response status code is {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED} (407).
*/
public ResultMatcher isProxyAuthenticationRequired() {
return matcher(HttpStatus.PROXY_AUTHENTICATION_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED} (505).
*/
public ResultMatcher isHttpVersionNotSupported() {
return matcher(HttpStatus.HTTP_VERSION_NOT_SUPPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_TIMEOUT} (408).
*/
public ResultMatcher isRequestTimeout() {
return matcher(HttpStatus.REQUEST_TIMEOUT);
}
/**
* Assert the response status code is {@code HttpStatus.VARIANT_ALSO_NEGOTIATES} (506).
*/
public ResultMatcher isVariantAlsoNegotiates() {
return matcher(HttpStatus.VARIANT_ALSO_NEGOTIATES);
}
/**
* Assert the response status code is {@code HttpStatus.CONFLICT} (409).
*/
public ResultMatcher isConflict() {
return matcher(HttpStatus.CONFLICT);
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_STORAGE} (507).
*/
public ResultMatcher isInsufficientStorage() {
return matcher(HttpStatus.INSUFFICIENT_STORAGE);
}
/**
* Assert the response status code is {@code HttpStatus.GONE} (410).
*/
public ResultMatcher isGone() {
return matcher(HttpStatus.GONE);
}
/**
* Assert the response status code is {@code HttpStatus.LOOP_DETECTED} (508).
*/
public ResultMatcher isLoopDetected() {
return matcher(HttpStatus.LOOP_DETECTED);
}
/**
* Assert the response status code is {@code HttpStatus.LENGTH_REQUIRED} (411).
*/
public ResultMatcher isLengthRequired() {
return matcher(HttpStatus.LENGTH_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED} (509).
*/
public ResultMatcher isBandwidthLimitExceeded() {
return matcher(HttpStatus.valueOf(509));
}
/**
* Assert the response status code is {@code HttpStatus.PRECONDITION_FAILED} (412).
*/
public ResultMatcher isPreconditionFailed() {
return matcher(HttpStatus.PRECONDITION_FAILED);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_EXTENDED} (510).
*/
public ResultMatcher isNotExtended() {
return matcher(HttpStatus.NOT_EXTENDED);
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413).
*/
public ResultMatcher isRequestEntityTooLarge() {
return matcher(HttpStatus.REQUEST_ENTITY_TOO_LARGE);
}
/**
* Assert the response status code is {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED} (511).
*/
public ResultMatcher isNetworkAuthenticationRequired() {
return matcher(HttpStatus.valueOf(511));
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414).
*/
public ResultMatcher isRequestUriTooLong() {
return matcher(HttpStatus.REQUEST_URI_TOO_LONG);
}
/**
/**
* Assert the response status code is {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE} (415).
*/
public ResultMatcher isUnsupportedMediaType() {
return matcher(HttpStatus.UNSUPPORTED_MEDIA_TYPE);
}
/**
* Assert the response status code is {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE} (416).
*/
public ResultMatcher isRequestedRangeNotSatisfiable() {
return matcher(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE);
}
/**
* Assert the response status code is {@code HttpStatus.EXPECTATION_FAILED} (417).
*/
public ResultMatcher isExpectationFailed() {
return matcher(HttpStatus.EXPECTATION_FAILED);
}
/**
* Assert the response status code is {@code HttpStatus.I_AM_A_TEAPOT} (418).
*/
public ResultMatcher isIAmATeapot() {
return matcher(HttpStatus.valueOf(418));
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} (419).
* @deprecated matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
*/
public ResultMatcher isInsufficientSpaceOnResource() {
return matcher(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE);
}
/**
* Assert the response status code is {@code HttpStatus.METHOD_FAILURE} (420).
* @deprecated matching the deprecation of HttpStatus.METHOD_FAILURE
*/
public ResultMatcher isMethodFailure() {
return matcher(HttpStatus.METHOD_FAILURE);
}
/**
* Assert the response status code is {@code HttpStatus.DESTINATION_LOCKED} (421).
* @deprecated matching the deprecation of HttpStatus.DESTINATION_LOCKED
*/
public ResultMatcher isDestinationLocked() {
return matcher(HttpStatus.DESTINATION_LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.UNPROCESSABLE_ENTITY} (422).
*/
public ResultMatcher isUnprocessableEntity() {
return matcher(HttpStatus.UNPROCESSABLE_ENTITY);
}
/**
* Assert the response status code is {@code HttpStatus.LOCKED} (423).
*/
public ResultMatcher isLocked() {
return matcher(HttpStatus.LOCKED);
}
/**
* Assert the response status code is {@code HttpStatus.FAILED_DEPENDENCY} (424).
*/
public ResultMatcher isFailedDependency() {
return matcher(HttpStatus.FAILED_DEPENDENCY);
}
/**
* Assert the response status code is {@code HttpStatus.UPGRADE_REQUIRED} (426).
*/
public ResultMatcher isUpgradeRequired() {
return matcher(HttpStatus.UPGRADE_REQUIRED);
}
/**
* Assert the response status code is {@code HttpStatus.PRECONDITION_REQUIRED} (428).
*/
public ResultMatcher isPreconditionRequired() {
return matcher(HttpStatus.valueOf(428));
}
/**
* Assert the response status code is {@code HttpStatus.TOO_MANY_REQUESTS} (429).
*/
public ResultMatcher isTooManyRequests() {
return matcher(HttpStatus.valueOf(429));
}
/**
* Assert the response status code is {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE} (431).
*/
public ResultMatcher isRequestHeaderFieldsTooLarge() {
return matcher(HttpStatus.valueOf(431));
}
/**
* Assert the response status code is {@code HttpStatus.INTERNAL_SERVER_ERROR} (500).
*/
public ResultMatcher isInternalServerError() {
return matcher(HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
* Assert the response status code is {@code HttpStatus.NOT_IMPLEMENTED} (501).
*/
public ResultMatcher isNotImplemented() {
return matcher(HttpStatus.NOT_IMPLEMENTED);
}
/**
* Assert the response status code is {@code HttpStatus.BAD_GATEWAY} (502).
*/
public ResultMatcher isBadGateway() {
return matcher(HttpStatus.BAD_GATEWAY);
}
/**
* Assert the response status code is {@code HttpStatus.SERVICE_UNAVAILABLE} (503).
*/
public ResultMatcher isServiceUnavailable() {
return matcher(HttpStatus.SERVICE_UNAVAILABLE);
}
/**
* Assert the response status code is {@code HttpStatus.GATEWAY_TIMEOUT} (504).
*/
public ResultMatcher isGatewayTimeout() {
return matcher(HttpStatus.GATEWAY_TIMEOUT);
}
/**
* Assert the response status code is {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED} (505).
*/
public ResultMatcher isHttpVersionNotSupported() {
return matcher(HttpStatus.HTTP_VERSION_NOT_SUPPORTED);
}
/**
* Assert the response status code is {@code HttpStatus.VARIANT_ALSO_NEGOTIATES} (506).
*/
public ResultMatcher isVariantAlsoNegotiates() {
return matcher(HttpStatus.VARIANT_ALSO_NEGOTIATES);
}
/**
* Assert the response status code is {@code HttpStatus.INSUFFICIENT_STORAGE} (507).
*/
public ResultMatcher isInsufficientStorage() {
return matcher(HttpStatus.INSUFFICIENT_STORAGE);
}
/**
* Assert the response status code is {@code HttpStatus.LOOP_DETECTED} (508).
*/
public ResultMatcher isLoopDetected() {
return matcher(HttpStatus.LOOP_DETECTED);
}
/**
* Assert the response status code is {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED} (509).
*/
public ResultMatcher isBandwidthLimitExceeded() {
return matcher(HttpStatus.valueOf(509));
}
/**
* Assert the response status code is {@code HttpStatus.NOT_EXTENDED} (510).
*/
public ResultMatcher isNotExtended() {
return matcher(HttpStatus.NOT_EXTENDED);
}
/**
* Assert the response status code is {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED} (511).
*/
public ResultMatcher isNetworkAuthenticationRequired() {
return matcher(HttpStatus.valueOf(511));
}
/**
* Match the expected response status to that of the HttpServletResponse
*/
private ResultMatcher matcher(final HttpStatus status) {
private ResultMatcher matcher(final HttpStatus status) {
return new ResultMatcher() {
public void match(MvcResult result) {
assertEquals("Status", status.value(), result.getResponse().getStatus());

View File

@@ -62,7 +62,7 @@ final class PatternMappingFilterProxy implements Filter {
Assert.notNull(delegate, "A delegate Filter is required");
this.delegate = delegate;
for(String urlPattern : urlPatterns) {
addUrlPattern(urlPattern);
addUrlPattern(urlPattern);
}
}
@@ -127,4 +127,4 @@ final class PatternMappingFilterProxy implements Filter {
this.delegate.destroy();
}
}
}

View File

@@ -228,9 +228,9 @@ public class MockHttpServletRequestBuilderTests {
assertEquals("bar=baz", request.getParameter("foo"));
}
@Test
public void acceptHeader() throws Exception {
this.builder.accept(MediaType.TEXT_HTML, MediaType.APPLICATION_XML);
@Test
public void acceptHeader() throws Exception {
this.builder.accept(MediaType.TEXT_HTML, MediaType.APPLICATION_XML);
MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
List<String> accept = Collections.list(request.getHeaders("Accept"));

View File

@@ -40,7 +40,7 @@ public class ExceptionHandlerTests {
standaloneSetup(new PersonController()).build()
.perform(get("/person/Clyde"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("errorView"));
.andExpect(forwardedUrl("errorView"));
}

View File

@@ -52,32 +52,32 @@ public class RedirectTests {
public void save() throws Exception {
this.mockMvc.perform(post("/persons").param("name", "Andy"))
.andExpect(status().isMovedTemporarily())
.andExpect(redirectedUrl("/persons/Joe"))
.andExpect(model().size(1))
.andExpect(model().attributeExists("name"))
.andExpect(flash().attributeCount(1))
.andExpect(flash().attribute("message", "success!"));
.andExpect(redirectedUrl("/persons/Joe"))
.andExpect(model().size(1))
.andExpect(model().attributeExists("name"))
.andExpect(flash().attributeCount(1))
.andExpect(flash().attribute("message", "success!"));
}
@Test
public void saveWithErrors() throws Exception {
this.mockMvc.perform(post("/persons"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("persons/add"))
.andExpect(model().size(1))
.andExpect(model().attributeExists("person"))
.andExpect(flash().attributeCount(0));
.andExpect(forwardedUrl("persons/add"))
.andExpect(model().size(1))
.andExpect(model().attributeExists("person"))
.andExpect(flash().attributeCount(0));
}
@Test
public void getPerson() throws Exception {
this.mockMvc.perform(get("/persons/Joe").flashAttr("message", "success!"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("persons/index"))
.andExpect(model().size(2))
.andExpect(model().attribute("person", new Person("Joe")))
.andExpect(model().attribute("message", "success!"))
.andExpect(flash().attributeCount(0));
.andExpect(forwardedUrl("persons/index"))
.andExpect(model().size(2))
.andExpect(model().attribute("person", new Person("Joe")))
.andExpect(model().attribute("message", "success!"))
.andExpect(flash().attributeCount(0));
}

View File

@@ -56,26 +56,26 @@ public class FlashAttributeAssertionTests {
@Test
public void testExists() throws Exception {
this.mockMvc.perform(post("/persons"))
.andExpect(flash().attributeExists("one", "two", "three"));
.andExpect(flash().attributeExists("one", "two", "three"));
}
@Test
public void testEqualTo() throws Exception {
this.mockMvc.perform(post("/persons"))
.andExpect(flash().attribute("one", "1"))
.andExpect(flash().attribute("two", 2.222))
.andExpect(flash().attribute("three", new URL("http://example.com")))
.andExpect(flash().attribute("one", equalTo("1"))) // Hamcrest...
.andExpect(flash().attribute("two", equalTo(2.222)))
.andExpect(flash().attribute("three", equalTo(new URL("http://example.com"))));
.andExpect(flash().attribute("one", "1"))
.andExpect(flash().attribute("two", 2.222))
.andExpect(flash().attribute("three", new URL("http://example.com")))
.andExpect(flash().attribute("one", equalTo("1"))) // Hamcrest...
.andExpect(flash().attribute("two", equalTo(2.222)))
.andExpect(flash().attribute("three", equalTo(new URL("http://example.com"))));
}
@Test
public void testMatchers() throws Exception {
this.mockMvc.perform(post("/persons"))
.andExpect(flash().attribute("one", containsString("1")))
.andExpect(flash().attribute("two", closeTo(2, 0.5)))
.andExpect(flash().attribute("three", notNullValue()));
.andExpect(flash().attribute("one", containsString("1")))
.andExpect(flash().attribute("two", closeTo(2, 0.5)))
.andExpect(flash().attribute("three", notNullValue()));
}

View File

@@ -48,10 +48,10 @@ public class RequestAttributeAssertionTests {
@Test
public void testRequestAttributeEqualTo() throws Exception {
this.mockMvc.perform(get("/main/1").servletPath("/main"))
.andExpect(request().attribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, "/{id}"))
.andExpect(request().attribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "/1"))
.andExpect(request().attribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, equalTo("/{id}")))
.andExpect(request().attribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, equalTo("/1")));
.andExpect(request().attribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, "/{id}"))
.andExpect(request().attribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "/1"))
.andExpect(request().attribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, equalTo("/{id}")))
.andExpect(request().attribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, equalTo("/1")));
}
@Test
@@ -60,8 +60,8 @@ public class RequestAttributeAssertionTests {
String producibleMediaTypes = HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE;
this.mockMvc.perform(get("/1"))
.andExpect(request().attribute(producibleMediaTypes, hasItem(MediaType.APPLICATION_JSON)))
.andExpect(request().attribute(producibleMediaTypes, not(hasItem(MediaType.APPLICATION_XML))));
.andExpect(request().attribute(producibleMediaTypes, hasItem(MediaType.APPLICATION_JSON)))
.andExpect(request().attribute(producibleMediaTypes, not(hasItem(MediaType.APPLICATION_XML))));
}

View File

@@ -54,14 +54,14 @@ public class SessionAttributeAssertionTests {
@Test
public void testSessionAttributeEqualTo() throws Exception {
this.mockMvc.perform(get("/"))
.andExpect(request().sessionAttribute("locale", Locale.UK))
.andExpect(request().sessionAttribute("locale", equalTo(Locale.UK)));
.andExpect(request().sessionAttribute("locale", Locale.UK))
.andExpect(request().sessionAttribute("locale", equalTo(Locale.UK)));
}
@Test
public void testSessionAttributeMatcher() throws Exception {
this.mockMvc.perform(get("/"))
.andExpect(request().sessionAttribute("locale", notNullValue()));
.andExpect(request().sessionAttribute("locale", notNullValue()));
}