Commit Graph

976 Commits

Author SHA1 Message Date
stsypanov
29f382b04e Simplify String concatenation 2019-03-14 17:24:33 +01:00
Sam Brannen
9d2e7ced89 Favor Math.[min|max]() over handcrafted code
In line with the general trend toward favoring core JDK APIs for common
tasks in Spring Framework 5.2, this commit replaces handcrafted
statements with Math.min() and Math.max() were applicable.
2019-03-14 16:48:44 +01:00
Juergen Hoeller
40c62139ae Early resolution of unique factory methods in configuration classes
Includes consistent bean class resolution in the enhancement step as well as general reflection optimizations for user-declared methods.

Closes gh-22420
2019-03-12 17:17:24 +01:00
Juergen Hoeller
ac4c37d8e2 Merge branch '5.1.x' 2019-03-07 18:05:46 +01:00
Juergen Hoeller
6c87ef09c1 Polishing 2019-03-07 17:55:32 +01:00
Sam Brannen
c0b6488ed5 Fix typo 2019-03-05 16:47:26 +01:00
www
ef91313342 Use String::isEmpty instead of "".equals(arg) when arg is not null 2019-03-05 14:32:56 +01:00
Sam Brannen
e272e2e151 Support conditional processing in TestContext event annotations
This commit introduces support for SpEL expressions for conditional
event processing in annotations such as @BeforeTestClass,
@BeforeTestMethod, etc.

This commit also introduces a new getTestContext() method in
TestContextEvent in order to improve the readability of such SpEL
expressions.

See gh-18490
2019-03-02 17:26:57 +01:00
Sam Brannen
f6d62eda8b Add missing @Nullable declarations to TestContext return values 2019-03-02 16:36:23 +01:00
Sam Brannen
8649061acc Polish Javadoc for TestContext 2019-03-02 16:25:23 +01:00
Sam Brannen
a16dd95ab7 Polishing 2019-03-01 20:39:25 +01:00
Sam Brannen
416346200f Polishing 2019-03-01 20:07:09 +01:00
Sam Brannen
297fd7629a Polishing 2019-03-01 19:34:13 +01:00
Sam Brannen
dd1330d05e Fix CheckStyle violations
See gh-18490
2019-03-01 17:40:32 +01:00
Sam Brannen
2d6624de71 Polish support for publishing TestContext lifecycle events
See gh-18490
2019-03-01 15:25:35 +01:00
Frank Scheffler
34fee867d2 Provide support for publishing TestContext lifecycle events
This commit introduces a new EventPublishingTestExecutionListener for
publishing events to the test ApplicationContext. These may be consumed
by @EventListener annotated methods to react to the TestContext
lifecycle. The listener is not registered by default.

Closes gh-18490
2019-03-01 15:22:54 +01:00
Loïc Ledoyen
d77b36bf3b Open parameter autowiring utility for external use (#2060)
* Make AutowireUtils public and protect its current API
* Move ParameterAutowireUtils features to AutowireUtils

Closes gh-2060
2019-02-27 15:15:45 +01:00
Sam Brannen
a7770e7448 Remove ApplicationContext dependency from ParameterAutowireUtils
This commit is a prerequisite for gh-2060.
2019-02-26 15:22:25 +01:00
Juergen Hoeller
5c2f3079fd Sync between MockHttpServletResponse copies
See gh-22466
2019-02-25 23:14:37 +01:00
stsypanov
1c24dc1f27 Simplify String concatenation 2019-02-25 12:13:35 +01:00
Juergen Hoeller
ba0c48b933 Polishing 2019-02-08 18:02:28 +01:00
Juergen Hoeller
e9626779ee @Resource provides dependency descriptor for resolving beans by name
Closes gh-22359
2019-02-07 15:56:00 +01:00
Juergen Hoeller
7a7958f275 MockMvcResultMatchers.forwardedUrl argument declared as nullable
Issue: SPR-17623
2018-12-25 13:20:09 +01:00
Rossen Stoyanchev
270099383b Add protected method in StandaloneMockMvcBuilder
To allow sub-classes to register additional MVC infrastructure.

Issue: SPR-17520
2018-12-12 11:40:33 -05:00
Juergen Hoeller
9efea7eb73 MockHttpServletRequest preserves original Accept-Language header value
Issue: SPR-17566
2018-12-04 22:07:43 +01:00
Sam Brannen
aa7f69a5d1 Ensure that parameter resolution in SpringExtension is thread-safe
Prior to this commit, parallel execution of @BeforeEach and @AfterEach
methods that accepted @Autowired arguments would fail intermittently
due to a race condition in the internal implementation of the JDK's
java.lang.reflect.Executable.getParameters() method.

This commit addresses this issue by creating instances of
SynthesizingMethodParameter via
SynthesizingMethodParameter.forExecutable(Executable, int) instead of
SynthesizingMethodParameter.forParameter(Parameter), since the latter
looks up the parameter index by iterating over the array returned by
Executable.getParameters() (which is not thread-safe).

Issue: SPR-17533
2018-11-23 16:35:19 +01:00
Juergen Hoeller
ae8f680d2e Polishing 2018-11-22 18:21:56 +01:00
Rossen Stoyanchev
759013eb17 Consistent isEmpty check in WebTestClient
Issue: SPR-17522
2018-11-20 23:02:53 -05:00
Juergen Hoeller
8c7579eba8 Polishing 2018-11-20 22:06:44 +01:00
Hanope
bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
Sam Brannen
42a95b8f35 Fix typo and polish 2018-10-29 14:47:20 +01:00
Rossen Stoyanchev
ecd0d7f0f6 Complete initialization with bindToRouterFunction
Issue: SPR-17239
2018-10-12 17:11:35 -04:00
Rossen Stoyanchev
658c7f99d7 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:41:42 -04:00
Rossen Stoyanchev
c5ca56bd50 Polish 2018-10-12 12:15:45 -04:00
Juergen Hoeller
bfc5ad890e MockHttpServletRequest resets InputStream/Reader on setContent
Issue: SPR-17373
2018-10-12 16:00:31 +02:00
Rossen Stoyanchev
8df0bc88d2 Improve access to raw content in WebTestClient
If the content has not been consumed, cause it to be produced, and
wait for a certain amount of time before giving up, so the raw content
can be made available. This can occur when:

1) In a mock server scenario the Flux representing the client request
content is passed directly to the mock server request, but is never
consumed because of an error before the body is read.

2) Test obtains FluxExchangeResult (e.g. for streaming) but instead of
consuming the Flux, it calls getResponseBodyContent() instead.

Issue: SPR-17363
2018-10-11 20:25:56 -04:00
Rossen Stoyanchev
c567e65eea WritetapConnector internal refactoring
Extract a common delegate class to share between the request and the
to wiretap a Publisher and record and buffer its data.

Preparation for SPR-17363.
2018-10-11 19:47:37 -04:00
Juergen Hoeller
efdbddd358 Full alignment of spring-test vs spring-web MockCookie variants
Issue: SPR-17321
2018-10-09 23:13:18 +02:00
Rossen Stoyanchev
29ff8a8d12 More defensive check for MockAsyncContext
Avoid automatically unwrapping the request in TestDispatcherServlet,
if we find the MockAsyncContext.

Issue: SPR-17353
2018-10-09 11:56:47 -04:00
Rossen Stoyanchev
1489457025 Restore calls to setLocale in MockHttpServletResponse
Issue: SPR-17284
2018-10-05 13:50:41 -04:00
Sam Brannen
e63bffcfa0 Introduce not-null precondition for MockCookie parsing 2018-10-02 13:07:20 +02:00
Sam Brannen
77205ca165 Polish MockCookie contribution
Issue: SPR-17321, #1974
2018-10-02 13:06:16 +02:00
Sam Brannen
49bc746640 Polish MockCookie[Tests] 2018-10-02 12:41:07 +02:00
Michael Bell
1b8421c7fe Fix MockCookie parsing when attribute is omitted
Issue: SPR-17321, #1974
2018-10-02 06:18:45 -04:00
Juergen Hoeller
255015fc6b Prepared for backport to 4.3.20 and 5.0.10
Issue: SPR-17295
2018-09-29 17:08:57 +02:00
Juergen Hoeller
a76b8deda5 Consistent copyright header and fine-tuned javadoc in test/web mocks
Issue: SPR-17295
2018-09-24 00:27:50 +02:00
Juergen Hoeller
51ba322947 MockHttpServletRequest allows for removing registered header values
Includes full alignment of spring-test vs spring-web mock variants.

Issue: SPR-17295
2018-09-23 14:44:15 +02:00
Toshiaki Maki
d570f82456 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:16:14 -04:00
Juergen Hoeller
9614817e88 Do not proxy test instances based on "original instance" convention
Issue: SPR-17137
2018-08-24 00:49:01 +02:00
Juergen Hoeller
6bcb454a0d Polishing 2018-08-16 19:31:10 +02:00