Commit Graph

567 Commits

Author SHA1 Message Date
Brian Clozel
74d3bceb19 Add missing StatusResultMatcher for HTTP Status 451
Issue: SPR-13632
2015-12-29 21:23:09 +01:00
Juergen Hoeller
41ee25b1e7 Convenience constructors for common view prefix/suffix scenarios
Issue: SPR-13813
2015-12-22 12:00:49 +01:00
Sam Brannen
66562f2589 Require JUnit 4.12 or higher in the TestContext framework
Issue: SPR-13275
2015-12-19 18:43:59 +01:00
Sam Brannen
9eb713ae2c Mention DCBeforeModesTEL in TestExecutionListener Javadoc 2015-12-17 17:45:08 +01:00
Juergen Hoeller
db05f43a75 Require JsonPath 1.1+
Issue: SPR-13729
2015-12-17 17:13:27 +01:00
Juergen Hoeller
935c0a463e Revised MockMvcResultHandlers logger initialization
Issue: SPR-13802
2015-12-16 21:49:48 +01:00
Juergen Hoeller
997278e3ed Polishing 2015-12-16 20:19:41 +01:00
Rossen Stoyanchev
c8aa48faa9 Add params(MultiValueMap) to MockMvc
Issue: SPR-13801
2015-12-16 11:51:59 -05:00
Juergen Hoeller
11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Juergen Hoeller
4261f34b63 Consistent and lenient HttpMethod resolution across all web modules
Issue: SPR-13776
2015-12-09 12:26:44 +01:00
Juergen Hoeller
40cff5e340 Polishing 2015-12-07 17:30:25 +01:00
Juergen Hoeller
a4f5c46fed MockHttpServletResponse.setIntHeader supports 'Content-Length' header as well
Issue: SPR-13752
2015-12-02 13:36:35 +01:00
Juergen Hoeller
aef6b20626 Removed tests for invalid -1 index (for compatibility with JsonPath 2.1) 2015-11-27 14:11:40 +01:00
Juergen Hoeller
dd647659b3 Rearranged cache test class names across several modules 2015-11-26 16:30:44 +01:00
Juergen Hoeller
fd84262e71 Polishing 2015-11-25 23:09:24 +01:00
Stephane Nicoll
bf1afdfdc9 Add cache tests for JCache 2015-11-24 10:15:09 +01:00
Stephane Nicoll
610b5a20ea Fix test name 2015-11-23 18:22:53 +01:00
Sam Brannen
59d60c60cf Polishing 2015-11-16 01:44:16 +01:00
Sam Brannen
4b682275c9 Clean up warnings in spring-test 2015-11-14 22:57:33 +01:00
Juergen Hoeller
5b901852e6 Upgrade to HtmlUnit 2.19
This upgrade includes AutoCloseable support for HtmlUnit WebConnections as introduced in 2.19, while remaining compatible with 2.18.

Issue: SPR-13686
2015-11-14 15:32:42 +01:00
Rossen Stoyanchev
8c127ad3c9 Property init HandlerMapping in standalone MockMvc
Issue: SPR-13637
2015-11-11 15:14:18 -05:00
Juergen Hoeller
b057e503ef Adapted exception message expectations
Issue: SPR-13621
2015-11-05 18:06:14 +01:00
Hronom
1d60a6a6af Added strict compare mode for Json
Issue: SPR-13607
2015-10-29 17:05:37 +01:00
Rossen Stoyanchev
323fa8510d Call complete() on MockAsyncContext after dispatch
Issue: SPR-13615
2015-10-29 10:12:47 -04:00
Sam Brannen
1bf7249d59 Suppress deprecation warning in HtmlUnitRequestBuilderTests 2015-10-16 19:15:29 +02:00
Juergen Hoeller
66177dfd8c StreamUtils.emptyInput() for consistent empty InputStream exposure
Issue: SPR-13563
2015-10-12 22:25:40 +02:00
Sam Brannen
3db62d5494 Remove MimeTypeResolver since JAF is part of Java SE 6+
The inner MimeTypeResolver class is no longer necessary in the
MockServletContext since the Java Activation Framework (JAF) is a
standard part of Java SE since Java 6.
2015-10-06 15:56:00 +02:00
Sam Brannen
61a46db101 Treat query param w/o "=" as empty string in HtmlUnitRequestBuilder
Prior to this commit, HtmlUnitRequestBuilder stored empty query
parameters declared without an equals sign as null (i.e., query
parameters such as 'error' in 'http://example.com/login?error').

This commit addresses this issue by ensuring that
HtmlUnitRequestBuilder treats all empty query parameter values as empty
strings. Consequently, query strings such as '?error' and '?error=' now
both result in 'error' being stored as an empty string.

Issue: SPR-13524
2015-10-04 19:11:41 +02:00
Sam Brannen
283fc94572 Support null query param values in HtmlUnitRequestBuilder
Prior to this commit, HtmlUnitRequestBuilder would incorrectly attempt
to decode null values for query parameters (i.e., query parameters such
as 'error' in 'http://example.com/login?error') which resulted in a
NullPointerException since URLDecoder.decode() does not support null
values.

This commit fixes this issue by ensuring that HtmlUnitRequestBuilder
only attempts to decode non-null query parameter values.

Issue: SPR-13524
2015-09-30 21:48:14 +02:00
Sam Brannen
d5b4685391 Polish HtmlUnitRequestBuilderTests 2015-09-30 21:48:13 +02:00
Juergen Hoeller
a9fbbc55e6 Polishing 2015-09-28 22:11:10 +02:00
Sam Brannen
d883efcb2a Throw meaningful exception if JUnit 4.9 is not present
SpringJUnit4ClassRunner, SpringClassRule, and SpringMethodRule now
throw an IllegalStateException with a meaningful message if JUnit 4.9
is not present in the classpath (specifically if
org.junit.runners.model.MultipleFailureException cannot be loaded).

Issue: SPR-13521
2015-09-28 20:15:40 +02:00
Sam Brannen
d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Rossen Stoyanchev
df171ff5bb MockMvc request builder preserves double slashes
The MockHttpServletRequestBuilder now uses java.net.URI internally
rather than UriComponents.

This means that for the MockMvcRequestBuilders method variants that
accept a java.net.URI we can use it as is. The difference is almost
none but it does mean that you can create a URI with double slashes
(for testing purposes) and have it remain that way.

Issue: SPR-13435
2015-09-23 17:50:29 -04:00
Rossen Stoyanchev
fb3e054a31 Update Javadoc
Issue: SPR-13479
2015-09-23 17:29:21 -04:00
Sam Brannen
e2bfbdcfd1 Support attribute overrides with @ResponseStatus
This commit introduces support for attribute overrides for
@ResponseStatus when @ResponseStatus is used as a meta-annotation on
a custom composed annotation.

Specifically, this commit migrates all code that looks up
@ResponseStatus from using AnnotationUtils.findAnnotation() to using
AnnotatedElementUtils.findMergedAnnotation().

Issue: SPR-13441
2015-09-11 21:05:30 +02:00
Juergen Hoeller
bc13cb2af5 Polishing 2015-09-10 14:05:06 +02:00
Sam Brannen
ae8a341a55 Polishing 2015-09-08 18:34:47 +02:00
Juergen Hoeller
52fdfd59ab Polishing 2015-09-08 18:11:30 +02:00
Juergen Hoeller
667fc7e4a9 Polishing 2015-09-04 14:38:47 +02:00
Brian Clozel
d3d81c2864 Add MockHttpServletResponse.getDateHeader
This change adds a new `getDateHeader` method that converts date header
Strings to long values - making tests more readable.

This feature is also documented in the "what's new section" for 4.2.
2015-09-03 16:03:46 +02:00
Sam Brannen
527b778bf9 Clean up warnings in spring-test 2015-08-27 22:12:14 +02:00
Juergen Hoeller
7d30017429 StubWebApplicationContext supports AutowireCapableBeanFactory operations (as far as possible)
This is generally worthwhile but in particular fixes a regression with our Jackson SpringHandlerInstantiator in standalone MVC tests.

Issue: SPR-13375
2015-08-25 21:52:49 +02:00
Rossen Stoyanchev
473dd5e9e8 Unwrap if necessary for MultipartHttpServletRequest
Before this commit RequestPartServletServerHttpRequest simply did an
instanceof check for MultipartHttpServletRequest. That hasn't failed
because request wrapping typically happens in filters before the
DispatcherServlet calls the MultipartResolver.

With Spring MVC Test and the Spring Security integraiton however,
this order is reversed since there we prepare the multipart request
upfront, i.e. there is no actual parsing.

The commit unwraps the request if necessary.

Issue: SPR-13317
2015-08-21 10:28:08 -04:00
Sam Brannen
0cd21aa55f Fix typo in Javadoc for TestContextBootstrapper 2015-08-19 20:52:36 +02:00
Sam Brannen
7a17abe448 Introduce empty & non-empty JsonPath matchers
This commit introduces new `isEmpty()` and `isNotEmpty()` methods in
`JsonPathResultMatchers` and `JsonPathRequestMatchers` which delegate
to the new `assertValueIsEmpty()` and `assertValueIsNotEmpty()` methods
in `JsonPathExpectationsHelper`, respectively.

Issue: SPR-13352
2015-08-15 19:28:09 +02:00
Sam Brannen
4799668a98 Introduce additional JsonPath RequestMatchers in Spring MVC Test
Commit fffdd1e9e9 introduced additional
JsonPath result matchers in JsonPathResultMatchers for server-side
testing of MVC controllers.

This commit introduces comparable methods in JsonPathRequestMatchers
for client-side testing with a RestTemplate.

- isString()
- isBoolean()
- isNumber()
- isMap()

Issue: SPR-13320
2015-08-15 14:56:57 +02:00
Sam Brannen
e4f386ae1e Add regression test cases to JsonPathRequestMatchersTests 2015-08-15 14:15:13 +02:00
Sam Brannen
687af344de Polishing 2015-08-15 14:13:52 +02:00
Sam Brannen
5ee24c8482 Polish Javadoc for JsonPathRequestMatchers, etc. 2015-08-15 13:55:30 +02:00