Commit Graph

1139 Commits

Author SHA1 Message Date
Rossen Stoyanchev
3bb11a0123 Fix failing test
After the fix #658c7f for lenient parsing of dates, the error message
raised uses an HttpHeaders-formatted date. As a result the test
verifying the error message fails in the beginning of the month between
1-9 because it's formatted slightly differently.
2018-11-01 15:46:28 -04:00
Rossen Stoyanchev
b89cb20b1d Lenient date parsing in HeadersResultMatchers
Rather than formatting the expected value, and be susceptible to
minor formatting differences (e.g. 01 vs 1 for day of month), parse the
actual header value leniently with HttpHeaders and compare time values.

Issue: SPR-17330
2018-10-12 15:51:32 -04:00
Juergen Hoeller
52ed4226bd Tests for MockHttpServletRequestTests.setContent reset in 5.0.x
Issue: SPR-17373
2018-10-12 17:57:07 +02:00
Rossen Stoyanchev
fc2f3ecf44 More defensive check for MockAsyncContext
Avoid automatically unwrapping the request in TestDispatcherServlet,
if we find the MockAsyncContext.

Issue: SPR-17353
2018-10-09 11:57:34 -04:00
Rossen Stoyanchev
d551710c32 Restore calls to setLocale in MockHttpServletResponse
Issue: SPR-17284
2018-10-05 13:53:19 -04:00
Juergen Hoeller
a21ce42558 MockHttpServletRequest allows for removing registered header entries
Issue: SPR-17295
2018-09-29 17:36:03 +02:00
Toshiaki Maki
ee559bb2c8 Use long for expires and lastModified in HeaderAssertions
This commit changes the type of parameters so that HeaderAssertions
can assert expires and lastModified properly.

Issue: SPR-17194
2018-09-05 17:26:42 -04:00
Juergen Hoeller
b5270a9cff Polishing 2018-08-24 12:39:03 +02:00
Juergen Hoeller
92228f9e64 Fix recent javadoc errors
Issue: SPR-17174
2018-08-16 19:24:38 +02:00
Kazuhiro Sera
a80f4caf37 Fix typos detected by github.com/client9/misspell
(cherry picked from commit be211ceead)
2018-08-09 00:49:27 +02:00
Juergen Hoeller
f9307897b6 Polishing
(cherry picked from commit 2474c48749)
2018-08-02 17:18:08 +02:00
Juergen Hoeller
8c1290084d Polishing 2018-07-31 23:40:36 +02:00
Juergen Hoeller
fd75600c26 Polishing 2018-07-31 21:37:40 +02:00
Rossen Stoyanchev
2d83051ce1 bindToApplicatonContext uses WebSessionManager bean
Issue: SPR-17094
2018-07-26 16:05:33 -04:00
Rossen Stoyanchev
f9ff6d4192 Polish 2018-07-26 15:54:21 -04:00
Juergen Hoeller
93ef169c5c Polishing 2018-07-25 14:40:31 +02:00
Rossen Stoyanchev
9458186e83 Polish DefaultUriBuilderFactory 2018-07-16 21:24:52 -04:00
Juergen Hoeller
ea534b6820 Polishing 2018-06-29 20:07:53 +02:00
Juergen Hoeller
a631af80c1 Polishing
(cherry picked from commit 40efcc9)
2018-06-28 16:42:14 +02:00
Rossen Stoyanchev
9d36fd0b68 Respect async request timeout of -1 in MockMvc
When falling back on the timeout associated with the async request,
a value of -1 must be treated as: never time out.

Issue: SPR-16869
2018-05-24 12:36:47 -04:00
Sebastien Deleuze
4d69ec48b1 Add StatusResultMatchers.isEqualTo Kotlin extension
Issue: SPR-16429
2018-05-15 15:42:25 +02:00
Juergen Hoeller
a9548f93e4 Support for non-standard HTTP status in reactive ClientHttpResponse
Issue: SPR-16748

(cherry picked from commit a683472)
2018-05-02 16:04:01 +02:00
Rossen Stoyanchev
f7376bdde3 Better assertion message in MockPart
Issue: SPR-16767
2018-04-25 10:00:18 -04:00
sdeleuze
91c8b62817 Make ResponseSpec.expectBody Kotlin extension usable
Prior to this commit, due to KT-5464 type inference issue there was not
proper way to provide body expectations with WebTestClient. This commit
provides a workaround by updating the existing Kotlin extension to
return a Kotlin compatible API.

Issue: SPR-15692
2018-04-17 14:58:12 +02:00
Sam Brannen
c3bc125093 Suppress warning in SpringFailOnTimeoutTests 2018-04-14 16:44:47 +02:00
Sam Brannen
02e09098e4 Expand scope of SpringFailOnTimeoutTests
Issue: SPR-16716
2018-04-12 11:00:45 +02:00
Igor Suhorukov
230c8f93e8 Throw exception from user code in SpringFailOnTimeout even if a timeout occurs
Issue: SPR-16717
2018-04-12 11:00:35 +02:00
Rossen Stoyanchev
7a896d7d80 TestDispatcherServlet unwraps to find mock request
Issue: SPR-16695
2018-04-06 11:04:29 -04:00
Juergen Hoeller
912c270f2b Polishing 2018-03-31 17:49:21 +02:00
Sam Brannen
e5096be660 Polishing 2018-03-30 12:23:28 +02:00
Sam Brannen
f79562f8d1 Introduce tests for generics & @Nested test classes 2018-03-30 12:12:21 +02:00
Juergen Hoeller
d553ddc5b3 Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
2018-03-29 23:50:17 +02:00
igor-suhorukov
c1ff97e2a8 Short-circuit logic should be used in boolean contexts 2018-03-29 23:33:22 +02:00
Sam Brannen
9244090ba0 Support DI of individual constructor args in @Nested tests
Prior to this commit it was impossible to have an individual
constructor argument in a @Nested (i.e., inner) test class injected via
@Autowired, @Qualifier, or @Value.

This is due to a bug in javac on JDK versions prior to 9, whereby
annotation lookups performed directly via the
java.lang.reflect.Parameter API fail for inner class constructors.

Specifically, the parameter annotations array in the compiled byte code
for the user's test class excludes an entry for the implicit enclosing
instance parameter for an inner class constructor.

This commit introduces a workaround in ParameterAutowireUtils for this
off-by-one error by transparently looking up annotations on the
preceding Parameter object (i.e., index - 1). In addition, this commit
relies on the change recently introduced in MethodParameter in order to
compensate for the same JDK bug (see SPR-16652).

Issue: SPR-16653
2018-03-29 17:47:45 +02:00
Rossen Stoyanchev
f9e6ea5482 MvcResult returns asyncResult after asyncDispatch
Issue: SPR-16648
2018-03-28 22:15:16 -04:00
igor-suhorukov
4aae6a6dda Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646 2018-03-28 01:09:03 +02:00
Sam Brannen
75f70b269e Introduce @Nested tests with constructor injection
This commit introduces @Nested tests to verify support for constructor
injection when using the SpringExtension.

One of the tests is disabled on Java 8 due to a bug in javac that was
first fixed in JDK 9.

See https://github.com/junit-team/junit5/issues/1345 for details.
2018-03-27 16:45:26 +02:00
Juergen Hoeller
f00afe3247 Use (Concurrent)Map.computeIfAbsent for lazy nested collection creation 2018-03-23 17:36:23 +01:00
Arjen Poutsma
c56317928f Add formData() and multipartData() to ServerRequest
Issue: SPR-16551
2018-03-23 10:00:30 +01:00
Juergen Hoeller
c1405ef140 Polishing 2018-03-21 16:12:42 +01:00
Arjen Poutsma
b31d55dfce Deprecated ClientRequest.method in favor of ClientRequest.create
The former method clashed with the ClientRequest.method() getter.
2018-03-16 17:27:29 +01:00
Rossen Stoyanchev
72bbb2619d Commit actions are (properly) deferred
Issue: SPR-16597
2018-03-15 23:17:57 -04:00
Rossen Stoyanchev
541ee13934 Add bufferContent option to MockRestServiceServer
Issue: SPR-14694
2018-03-15 22:13:44 -04:00
Rossen Stoyanchev
f7e75a5b82 Polish MockRestServiceServer client tests 2018-03-15 22:13:43 -04:00
Sam Brannen
5f4d5f17f7 Polishing 2018-03-13 16:48:52 +01:00
Sam Brannen
2c2ce55f47 Support target type in JsonPath assertions for MockMvc results
This commit picks up where SPR-14498 left off by adding support for an
explicit target type when using JsonPath to perform an assertion against
the response content using a Hamcrest Matcher.

Specifically, there is a new overloaded value(Matcher<T>, Class<T>)
method in JsonPathResultMatchers for use with Hamcrest matchers where
the target type (i.e., Class<T>) can be specified.

Issue: SPR-16587
2018-03-13 15:55:39 +01:00
Bronwyn Perry-Huston
d64f2eb038 Add JSON matcher to assert on request body
Support asserting JSON regardless of order and formatting.
Based on same JsonExpectationHelper used in ContentResultMatchers.

Issue: SPR-13919
2018-03-13 12:27:05 +01:00
Sam Brannen
1fa1f2b58a Delete unused import 2018-03-10 16:56:33 +01:00
Rossen Stoyanchev
3653a37e27 Polish tests 2018-03-09 21:16:18 -05:00
Sam Brannen
107f8bb5fd Polishing 2018-03-09 18:19:30 +01:00