Commit Graph

1569 Commits

Author SHA1 Message Date
Sam Brannen
9d5881e0ad Suppress warnings, remove unused code, etc. 2020-06-20 17:15:35 +02:00
Rossen Stoyanchev
de0a043739 Add contains form data RequestMatcher
See gh-23671
2020-06-18 07:49:27 +01:00
Rossen Stoyanchev
bc33ae3f8b Update multipart RequestMatcher
See gh-23772
2020-06-18 07:49:27 +01:00
vspac
e01160db31 Multipart RequestMatcher's
See gh-23772
2020-06-18 07:49:27 +01:00
Juergen Hoeller
d36407d585 Deprecate rarely used bean definition variants
Closes gh-24875
2020-06-17 10:59:55 +02:00
Rossen Stoyanchev
5225a57411 Support for parsed PathPatterns in Spring MVC
See gh-24945
2020-06-15 11:25:35 +01:00
Sam Brannen
adc76a1d8f Suppress warnings in ResponseCreatorsTests 2020-06-14 19:45:51 +02:00
Sam Brannen
b9e52a8089 Delete dead code in MockServerHttpRequest 2020-06-09 17:38:34 +02:00
Arjen Poutsma
8b59b6a7f4 Merge branch '5.2.x' 2020-06-08 15:43:49 +02:00
Arjen Poutsma
0ccf5e19aa Undo MockServerRequest deprecation
Setting path variables (and making sure they are available in a
HandlerFunction) is more convenient with MockServerRequest than
having to set attributes in MockServerWebExchange.

This commit removes MockServerRequest's deprecation.

Closes gh-25087
2020-06-08 15:40:09 +02:00
Juergen Hoeller
a34f1e3759 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/MockServerHttpRequest.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java
2020-06-06 18:52:51 +02:00
Juergen Hoeller
d71957ce7c Polishing 2020-06-06 17:45:12 +02:00
Juergen Hoeller
5051d7302d Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java
#	spring-web/src/main/java/org/springframework/http/HttpHeaders.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/MockServerHttpRequest.java
2020-06-06 15:27:15 +02:00
Juergen Hoeller
f3d4df2fd4 Consistently check available local/remote addresses for non-null 2020-06-06 15:15:16 +02:00
Rossen Stoyanchev
8d449471c7 Polishing contribution
See gh-25148
2020-05-29 17:37:43 +01:00
Mihai Dumitrescu
b31b8ce6c1 Polishing in MockServerHttpRequest
Closes gh-25109
2020-05-29 16:31:19 +01:00
Rossen Stoyanchev
90ccabd60b Merge branch '5.2.x' 2020-05-27 19:12:57 +01:00
Rossen Stoyanchev
955f77bf5d Add error message to MockServerHttpRequest
Closes gh-25109
2020-05-27 18:57:02 +01:00
Rossen Stoyanchev
b5d9f27ca4 Merge branch '5.2.x' 2020-05-24 21:20:12 +01:00
Rossen Stoyanchev
8204055924 MockServerHttpRequest accepts custom HTTP method
Closes gh-25109
2020-05-23 10:40:25 +01:00
Rossen Stoyanchev
23233c3041 Shared read-only instance of UrlPathHelper
In many places UrlPathHelper is created and used without any
customizations, in some cases repeatedly. This commit adds a
shared read-only UrlPathHelper instance with default settings.

See gh-25100
2020-05-19 10:34:15 +01:00
Juergen Hoeller
99bd1a1533 Defensive null check against name parameter in AutowireMode#from
See gh-24285
2020-05-13 23:35:17 +02:00
Rossen Stoyanchev
875e7f8630 Match multiple values in HeaderAssertions
Closes gh-23878
2020-05-13 12:31:19 +01:00
Sam Brannen
7bcda3a29b Update Javadoc for TestContextTransactionUtils
See gh-24869
2020-05-11 14:10:06 +02:00
Sam Brannen
715e8c9ef6 Align TransactionManagementConfigurer support in TCF with production
This commit picks up where 613bd3be1d
left off by ensuring that a transaction manager configured via the
TransactionManagementConfigurer API takes precedence over any
transaction manager configured as a bean in the ApplicationContext
unless @Transactional is configured with a qualifier for the explicit
transaction manager to use in tests.

Closes gh-24869
2020-05-11 13:59:34 +02:00
Sam Brannen
613bd3be1d Honor TxMgmtConfigurer when @Primary tx mgr is present in TCF
Prior to this commit, the Spring TestContext Framework (TCF) favored a
@Primary transaction manger over one configured via the
TransactionManagementConfigurer API, and this contradicts the behavior
in production Spring applications.

This commit aligns the transaction manger lookup within the TCF so that
a transaction manger configured via the TransactionManagementConfigurer
API is properly favored over a @Primary transaction manager.

Closes gh-24869
2020-05-09 20:09:27 +02:00
Sam Brannen
745cfcb161 Upgrade tests to TestNG 7.1
See gh-24298
2020-05-09 17:36:34 +02:00
Sam Brannen
12e05280ad Upgrade to AssertJ 3.16 2020-05-06 15:22:23 +02:00
Rossen Stoyanchev
5883ea2721 Polishing contribution
See gh-24926
2020-05-06 10:53:25 +01:00
Evgenii Koba
e15ed44a68 Make HtmlUnitRequestBuilder handle form data file properly
See gh-18551
2020-05-06 10:53:25 +01:00
Sam Brannen
1b4b4c3302 Support @TestConstructor config via JUnit Platform config param
This commit introduces support for setting the
spring.test.constructor.autowire.mode property via a JUnit Platform
configuration parameter -- for example, via the
junit-platform.properties file.

Closes gh-24285
2020-05-03 19:02:44 +02:00
Sam Brannen
b8835c9f32 Copy MockHttpServletRequest changes to spring-web
See gh-24916
2020-04-17 16:20:42 +02:00
Sam Brannen
6b410df45b Retain brackets for IPV6 address in MockHttpServletRequest
According to the Javadoc for ServletRequest's getServerName() method,
when the `Host` header is set, the server name is "the value of the
part before ':' in the Host header value ...". For a value representing
an IPV6 address such as `[::ffff:abcd:abcd]`, the enclosing square
brackets should therefore not be stripped from the enclosed IPV6
address.

However, the changes made in conjunction with gh-16704 introduced a
regression in Spring Framework 4.1 for the getServerName() method in
MockHttpServletRequest by stripping the enclosing brackets from the
IPV6 address in the `Host` header. Similarly, the changes made in
conjunction with gh-20686 introduced a regression in Spring Framework
4.3.13 and 5.0.2 in the getRequestURL() method in
MockHttpServletRequest by delegating to the getServerName() method
which strips the enclosing brackets.

This commit fixes the implementation of getServerName() so that the
enclosing brackets are no longer stripped from an IPV6 address in the
`Host` header. The implementation of getRequestURL() is therefore also
fixed.

In addition, in order to avoid a NullPointerException, the
implementations of getServerName() and getServerPort() now assert that
an IPV6 address present in the `Host` header correctly contains an
opening and closing bracket and throw an IllegalStateException if that
is not the case.

Closes gh-24916
2020-04-17 15:01:35 +02:00
Sam Brannen
0017256968 Test that @TestConstructor can be used as a meta-annotation 2020-04-17 13:29:33 +02:00
Sam Brannen
a5498ba2ad Test status quo for @Primary + TransactionManagementConfigurer in TCF
This commit introduces an integration test for the status quo in the
Spring TestContext Framework (TCF) for multiple transaction managers
registered as @Primary and via the TransactionManagementConfigurer API.

In Spring Framework 5.3 we will revise the transaction manager lookup in
TestContextTransactionUtils so that the transaction manager configured
via the TransactionManagementConfigurer API is favored over a @Primary
transaction manager.

See gh-24869
2020-04-06 19:11:53 +02:00
Sam Brannen
a42944d364 Consolidate TxMgr lookup tests in the TCF
This commit consolidates TransactionManager lookup tests in the Spring
TestContext Framework (TCF), migrates some to JUnit Jupiter, simplifies
their implementations, and removes duplicated test cases.
2020-04-06 18:21:48 +02:00
Sam Brannen
dc5ddffd03 Polishing 2020-04-06 14:42:23 +02:00
Sam Brannen
a842434bff Document precedence for @DynamicPropertySource
Closes gh-24837
2020-04-01 18:09:31 +02:00
陈其苗
13970ae528 Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
2020-04-01 14:34:20 +02:00
Sam Brannen
e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Sam Brannen
9e30620ac2 Polish contribution
See gh-24805
2020-03-30 13:47:00 +02:00
Сергей Цыпанов
e63d1cf12d Improve usage of ByteArrayOutputStream/ByteArrayInputStream
Closes gh-24805
2020-03-30 13:22:21 +02:00
Qimiao Chen
7db00c9e22 Remove incorrect @Nullable in DynamicPropertiesContextCustomizer
Closes gh-24796
2020-03-28 15:29:01 +01:00
Rossen Stoyanchev
a606fb4b21 Fix checkstyle errors 2020-03-26 22:02:32 +00:00
Rossen Stoyanchev
3175f0771e Remove dumpString from DataBufferTestUtils
See gh-24786
2020-03-26 21:42:12 +00:00
Rossen Stoyanchev
7aa06b8610 Polishing contribution
See gh-24786
2020-03-26 21:42:12 +00:00
Сергей Цыпанов
f17b0125ff Simplify conversion of DataBuffer to String
See gh-24786
2020-03-26 21:42:12 +00:00
Qimiao Chen
9f2fd4f0d5 Fix broken link in Javadoc for DynamicPropertySource
Closes gh-24792

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-03-26 16:20:55 +01:00
Sébastien Deleuze
60dca027e7 Add Kotlin documentation and tests for @DynamicPropertySource
See gh-24540
2020-03-24 10:08:37 +01:00
Sam Brannen
cf7daa36c8 Add @DynamicPropertySource support in TestContext framework
This commit introduces a @DynamicPropertySource annotation that can be
used on methods in test classes that want to add properties to the
Environment with a dynamically supplied value.

This new feature can be used in conjunction with Testcontainers and
other frameworks that manage resources outside the lifecycle of a
test's ApplicationContext.

Closes gh-24540

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2020-03-23 17:10:18 +01:00