Commit Graph

1464 Commits

Author SHA1 Message Date
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 0652e4b485 Merge branch '5.1.x' 2019-02-22 14:51:00 +01:00
Juergen Hoeller c3fa900672 Upgrade to Hibernate Validator 5.4.3 and 6.0.15 2019-02-22 14:18:08 +01:00
Juergen Hoeller 783a7ca46b Merge branch '5.1.x' 2019-02-08 18:16:27 +01:00
Juergen Hoeller ba0c48b933 Polishing 2019-02-08 18:02:28 +01:00
Juergen Hoeller d25783329a Merge branch '5.1.x' 2019-02-07 16:01:14 +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
Sebastien Deleuze 0b9522c84e Migrate Kotlin Mockito tests to Mockk
Closes gh-22345
2019-02-05 15:47:08 +01:00
Juergen Hoeller 165d2511b9 Upgrade to Apache HttpClient 4.5.7 and Commons FileUpload 1.4
Includes RxJava 2.2.6, Netty 4.1.33, Undertow 2.0.17.
2019-02-05 00:46:07 +01:00
Juergen Hoeller c700ccbc00 Upgrade to Apache HttpClient 4.5.7
Includes Hibernate ORM 5.4.1 for integration tests.
2019-02-05 00:10:40 +01:00
Juergen Hoeller 493e9c1ff0 Consistent upgrade to Rome 1.12 and WebJars Locator 0.36 2019-01-24 15:18:43 +01:00
Juergen Hoeller d37a18ff03 Upgrade to Hibernate Validator 6.0.14 and Apache Johnzon 1.1.11
Includes OkHttp MockWebServer 3.12.1.
2019-01-08 00:50:44 +01:00
Juergen Hoeller 7a7958f275 MockMvcResultMatchers.forwardedUrl argument declared as nullable
Issue: SPR-17623
2018-12-25 13:20:09 +01:00
Rossen Stoyanchev 38ae282c3b Update log category precision for all tests
Replace the full category capped at 36 chars with the class name only
and 1 char per package, e.g. org.apache.commons.Foo -> o.a.c.Foo
2018-12-12 11:40:33 -05: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
Juergen Hoeller d5dab12909 NettyDataBufferFactory.join returns single-element buffer as-is
Issue: SPR-17560
2018-12-03 23:52:35 +01:00
Sam Brannen 58cde3c2e6 Avoid test compile-time dependency on junit-jupiter-engine
Issue: SPR-17533
2018-11-23 18:05:34 +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 c16f36b537 Upgrade to Mockito 2.23.4, Selenium 3.141.59, JSON-P 1.1.4 2018-11-22 18:24:18 +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
Juergen Hoeller ce5c65c0b0 Upgrade to JAXB 2.3.1, Groovy 2.5.4, Jetty 9.4.14, Tomcat 9.0.13
Includes JAX-WS 2.3.1, Awaitility 3.1.3, OkHttp 3.12, Woodstox 5.2.
2018-11-19 12:41:26 +01:00
Stephane Nicoll 7b6f2f8fb3 Polish contribution
Closes gh-2019
2018-11-19 08:45:33 +01:00
Hanope bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
Sam Brannen b3aad549c9 Fix @since tag 2018-11-10 16:56:39 +01:00
Sam Brannen 865f1f692a Introduce tests for @Sql and @Transactional support in @Nested test classes
This commit was inspired by the following question on Stack Overflow.

https://stackoverflow.com/questions/53236807/spring-boot-testing-run-script-in-a-nested-test-sql-script-sql
2018-11-10 15:47:30 +01:00
Sam Brannen 93df24af16 Polishing 2018-11-10 15:47:29 +01:00
Juergen Hoeller f65408f646 Avoid references to groovy-all artifact across all modules
Issue: SPR-17446
2018-11-05 12:27:07 +01:00
Rossen Stoyanchev c2b55e60cd 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:27:39 -04:00
Sam Brannen 42a95b8f35 Fix typo and polish 2018-10-29 14:47:20 +01:00
Juergen Hoeller 67bd3f670f Upgrade to AspectJ 1.9.2, Rome 1.11.1, OpenPDF 1.2.5, POI 4.0 2018-10-25 15:15:47 +02:00
Juergen Hoeller a0b42a3dfd Upgrade to Hibernate ORM 5.3.7 2018-10-18 18:05:26 +02:00
Juergen Hoeller 93bb78ec23 Avoid private bean classes in integration tests (for CGLIB on JDK 11)
Issue: SPR-16391
2018-10-15 12:26:38 +02:00
Juergen Hoeller 50949415d7 Upgrade spring-test to Hibernate ORM 5.3.6 (for JDK 11 compatibility)
Issue: SPR-16391
2018-10-15 00:39:25 +02: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
Juergen Hoeller 0b2c482e29 Upgrade to Selenium HtmlUnit Driver 2.33 2018-10-12 13:17:14 +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
Rossen Stoyanchev 050f44d75b Rename WebTestClientConnectorTests to match class name 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 31095f1d4e Move MockCookie parsing tests to correct class
Issue: SPR-17321, #1974
2018-10-02 12:43:17 +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
Juergen Hoeller 80e52de231 Upgrade to HtmlUnit 2.33 and Apache Johnzon 1.1.10 2018-09-20 11:55:50 +02:00
Juergen Hoeller cbc0fad961 Upgrade to Kotlin 1.2.70
Includes Hibernate ORM 5.1.16 and Hibernate Validator 6.0.13.
2018-09-13 18:23:42 +02:00
Juergen Hoeller e49896d95f Upgrade to Mockito 2.22, XMLUnit 2.6.2, JavaMail 1.6.2
Also includes Apache Johnzon 1.1.9.
2018-09-10 10:52:24 +02:00
Sam Brannen c450f8dd82 Revert "PoC: migrate from JUnit 4 to JUnit Jupiter Assertions"
This reverts commit fd352b84b3, and the
PoC will be moved to a feature branch.
2018-09-06 15:58:58 +02:00
Sam Brannen fd352b84b3 PoC: migrate from JUnit 4 to JUnit Jupiter Assertions 2018-09-06 14:36:19 +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 a6a6cf7d97 Upgrade to Java Activation Framework 1.2 as API dependency
Includes XMLUnit 2.6.1 and Undertow 2.0.13.

Issue: SPR-16115
2018-08-17 16:01:15 +02:00
Juergen Hoeller 6bcb454a0d Polishing 2018-08-16 19:31:10 +02:00
Juergen Hoeller 04d2d1da0d Consistently use double quotes (even if no interpolation needed)
Includes upgrade to Hibernate ORM 5.3.5, EclipseLink 2.7.3, Selenium HtmlUnit Driver 2.32.1, Jetty 9.4.12 RC2.
2018-08-16 15:32:44 +02:00
Sam Brannen d3be1cc6cb Use single quotes in Gradle build where appropriate 2018-08-15 17:57:56 +02:00
Sam Brannen 69e4f21f90 Use JUnit 5 Maven BOM in Gradle build
Issue: SPR-17129
2018-08-15 17:43:23 +02:00
Sam Brannen 50dc8c2358 Update JavaDoc for @BootstrapWith regarding local override
Issue: SPR-17006
2018-08-15 17:17:24 +02:00
Sam Brannen d20d95b7ac Allow directly present @BootstrapWith to override meta annotations
Prior to this commit, if a test class was meta-annotated with multiple
@BootstrapWith declarations that registered different
TestContextBootstrapper implementations, such a configuration would
result in an IllegalStateException, and there was no way to override
this behavior.

This commit addresses this shortcoming by relaxing the explicit
TestContextBootstrapper resolution in BootstrapUtils so that a directly
present @BootstrapWith annotation will now override declarations of
@BootstrapWith that are meta-present. In other words, if @BootstrapWith
is used as a meta-annotation, it can be overridden directly on the test
class via an explicit, local declaration of @BootstrapWith.

Issue: SPR-17006
2018-08-15 16:17:05 +02:00
Sam Brannen 1b54d2119d Polishing 2018-08-15 12:27:45 +02:00
Juergen Hoeller de38af6843 Upgrade to JUnit Jupiter 5.3 RC1 (and Jetty 9.4.12 RC1)
Includes Groovy 2.5.2, Undertow 2.0.12, Hibernate Validator 6.0.12.

Issue: SPR-17129
2018-08-14 20:33:30 +02:00
Sam Brannen 8126ffbc8c Fix broken links in JavaDoc
Issue: SPR-17174
2018-08-13 12:22:52 +02:00
Kazuhiro Sera be211ceead Fix typos detected by github.com/client9/misspell 2018-08-08 12:50:46 +02:00
Juergen Hoeller 821ab62492 Upgrade to RxJava 2.2 and Kotlin 1.2.60
Includes latest dependency updates (Mockito 2.21, Log4J 2.11.1, Hibernate ORM 5.3.4, Protobuf 3.6.1, JRuby 9.2, HtmlUnit 2.32, Selenium 3.14) for Spring Framework 5.1.

Issue: SPR-16388
Issue: SPR-16239
2018-08-03 23:18:10 +02:00
Rossen Stoyanchev c55c9eb029 Polish 2018-08-03 17:41:38 +03:00
Vedran Pavic bb2db87c2f Add support for adding cookies as headers in MockHttpServletResponse
Issue: SPR-17110
2018-08-03 16:44:14 +03:00
Juergen Hoeller 2474c48749 Polishing 2018-08-02 16:55:53 +02:00
stsypanov b5c691bdac SPR-17074 Replace pointless wrapping with Arrays.asList with iteration over array 2018-08-02 12:07:00 +02:00
Vedran Pavic 70dbaf9751 Publish binding event for replaced attributes in MockHttpSession
Issue: SPR-17109
2018-08-01 13:07:41 +02:00
Juergen Hoeller 9b671f8408 Polishing 2018-07-31 23:57:19 +02:00
Сергей Цыпанов f8340838b3 Use lambda expressions for lazy instantiation (#1911)
Issue: SPR-17074
2018-07-31 13:03:18 +02:00
Rossen Stoyanchev 23bda9a5a7 Fix compiler warnings 2018-07-27 08:49:45 -04:00
Rossen Stoyanchev fcbf06f050 Disable equals in JsonPath~ and XPathAssertions
Issue: SPR-17091
2018-07-27 08:40:56 -04:00
Rossen Stoyanchev bcb485b5ed bindToApplicatonContext uses WebSessionManager bean
Issue: SPR-17094
2018-07-26 15:53:41 -04:00
Rossen Stoyanchev c022f7c19d Polish 2018-07-26 15:53:41 -04:00
Juergen Hoeller 3881a4aded Polishing 2018-07-25 14:16:02 +02:00
Juergen Hoeller 47d8fe83df Upgrade to Interceptor API 1.2.2, Moneta 1.3, Rome 1.11 2018-07-24 14:44:56 +02:00
Juergen Hoeller 1603c4ab2f Programmatic ObjectProvider retrieval through BeanFactory API
Introduces getBeanProvider(Class) and getBeanProvider(ResolvableType), also narrowing getBean(String, Class) and isTypeMatch(String, Class) to a non-null Class argument and enriching NoUniqueBeanDefinitionException with a full ResolvableType. In addition, ObjectProvider supports iterable/stream access for collection-style resolution of multiple matching beans now, and collection injection falls back to an empty collection in a single-constructor case with non-null arguments.

Issue: SPR-17075
Issue: SPR-11419
Issue: SPR-15338
2018-07-24 00:42:03 +02:00
Rossen Stoyanchev c57e1afd2b ResulatMatcher.matchAll
Issue: SPR-16417
2018-07-20 23:02:47 -04:00
Rossen Stoyanchev 91122ec0f5 Add Consumer methods to WebTestClient assertion classes
Issue: SPR-16574
2018-07-20 22:28:40 -04:00
Rossen Stoyanchev 20de5003ff Hamcrest methods in WebTestClient
Issue: SPR-16729
2018-07-20 17:40:38 -04:00
Rossen Stoyanchev 0c62d6b5da Polish
Leaving out hamcrest for now, to address more broadly.

Issue: SPR-16741
2018-07-20 17:40:38 -04:00
Eric Deandrea 2734f01067 Provide XML assertions in WebTestClient
Adds XML-based assertions in
org.springframework.test.web.reactive.server.WebTestClient.BodyContentSpec
for asserting against the XML body as well as xPath,
similar to those assertions offered when using
MockMvcResultMatchers.xpath().

Issue: SPR-16741
2018-07-20 17:38:04 -04:00
Juergen Hoeller 9a43d2ec20 Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
2018-07-20 15:05:16 +02:00
Juergen Hoeller 867b3d233d Upgrade to OkHttp 3.11, Apache HttpClient 4.5.6, Hibernate Validator 6.0.11 2018-07-19 17:52:08 +02:00
Juergen Hoeller b3d6283d7d CookieAssertionTests expects language tag compliance by default
Issue: SPR-16700
2018-07-17 18:18:54 +02:00
Rossen Stoyanchev 75e45103b5 Polish DefaultUriBuilderFactory 2018-07-16 21:21:34 -04:00
Rossen Stoyanchev fd90b73748 Correlated WebFlux server log messages
Issue: SPR-16966
2018-07-05 08:27:13 -04:00
Sam Brannen 160002cf8b Polishing 2018-07-04 14:33:39 +02:00
Sam Brannen 755add3087 Verify that TestContextBootstrapper resolution ignores duplicates
This commit introduces a test to verify that multiple declarations of
@BootstrapWith that register the same TestContextBootstrapper type
(i.e., duplicates) do not result in an error.

Issue: SPR-17006
2018-07-04 13:58:49 +02:00
Juergen Hoeller d22d408261 Propagate read-only status through Session.setDefaultReadOnly(true)
Issue: SPR-16956
2018-07-03 22:22:19 +02:00
Juergen Hoeller 4ff1e3e74b Consistent abstract declaration for utility classes (plus polishing)
Issue: SPR-16968
2018-07-01 02:31:20 +02:00
Rossen Stoyanchev d74e09a925 Polish MockClientHttpRequest 2018-06-29 17:37:45 -04:00
Rossen Stoyanchev 7f555785dd Add getBodyAsString() to MockClientHttpRequest
Issue: SPR-16988
2018-06-29 17:34:23 -04:00
Juergen Hoeller e22466e9d5 Polishing 2018-06-29 19:44:15 +02:00
Juergen Hoeller 6f8a524eaa Upgrade to Tomcat 9.0.10, RxJava 2.1.16, EclipseLink 2.7.2, Selenium 3.13 2018-06-28 14:52:35 +02:00
Juergen Hoeller b0ece0e967 Remove hard configuration validation from SpringClassRule/MethodRule
Issue: SPR-16967
2018-06-28 14:15:16 +02:00
Phillip Webb a89e716cc7 Use tabs rather than spaces in tests
Update tests to ensure that tabs are used instead of spaces. Also
consistently apply a new line at the end of each file.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 81451aa800 Organize imports
Reorganize imports to ensure consistent ordering. This commit also
expands any `.*` static imports in favor of using fully-qualified
method references.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 5cedd0d5d4 Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs.
Also remove all trailing whitespace.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0b53c1096a Always use 'this.' when accessing fields
Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb eeebd51f57 Use consistent class design
Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0ad0f341bd Don't use single letter catch variables
Update existing catch blocks to ensure that `ex` is always used
in preference to `e` or `t` as the variable name.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 04a8c285df Fix annotation styling issues
Update all annotations so that each is on its own line and
consistently use the short form (i.e. don't use `value=`) when
possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e9d1b39aff Apply consistent copyright header
Add copyright header to `package-info.java` files and fix a few
malformed headers on existing java files.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb c3a17dfd47 Ensure all files end with a newline
Update all files to ensure that they always end with a new line.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e0480f75ac Fix javadoc checkstyle issues
Fix checkstyle violations for javadoc.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Sam Brannen 802763d26f Reintroduce suppression of deprecation warning 2018-06-15 00:43:21 +03:00
Sam Brannen 8027e1f109 Remove obsolete suppression of deprecation warning 2018-06-14 22:48:34 +03:00
Sam Brannen 4ae4788e93 Delete unused import 2018-06-14 22:46:10 +03:00
Juergen Hoeller 3fc8ec498c MockHttpServletRequest returns a single InputStream or Reader
Issue: SPR-16505
Issue: SPR-16499
2018-06-13 22:03:16 +02:00
Juergen Hoeller 9c36b53833 Upgrade to JAXB 2.3.0.1, Aalto XML 1.1, Rome 1.10 2018-06-11 22:01:51 +02:00
Rossen Stoyanchev a31204938a Getter for DispatcherSerlvet in MockMvc
Issue: SPR-16924
2018-06-11 12:42:55 -04:00
Brian Clozel 417354da8a Remove dependency management noise from POMs
Prior to this commit, the generated POMs for Spring Framework modules
would contain unneeded/harmful information from the Spring Framework
build:

1. The BOM imports applied to each module by the dependency
management plugin, for example for Netty or Reactor Netty.
Spring should not export that opinion to its POMs.

2. The exclusion of "org.slf4:jcl-over-slf4j" from *all* dependencies,
which made the POMs much larger than necessary and suggested to
developers that they should exclude it as well when using all those
listed dependencies. In fact, only Apache Tiles currently brings that
transitively.

This commit removes that information from the POMs.
The dependencyManagement Gradle plugin is disabled for POM generation
and we manually resolve the dependency versions during the generation
phase.
The Gradle build is streamlined to exclude "org.slf4:jcl-over-slf4j"
only when necessary.

Issue: SPR-16893
2018-06-11 15:57:54 +02:00
Juergen Hoeller 0941081b0a Upgrade to HSQLDB 2.4.1, Derby 10.14.2.0, HtmlUnit 2.31, Selenium 3.12 2018-06-06 21:24:53 +02:00
Rossen Stoyanchev 72b1d4c648 Remove explicit references to Reactor Netty version
...now that 0.8 is also listed in the Reactor bom.

Issue: SPR-16387
2018-06-06 14:35:54 -04:00
Rossen Stoyanchev 124d4c833c Support for Servlet request params with HTTP DELETE
This commit adds FormContentFilter, which is the same as the
HttpPutFormContentFilter but also supports DELETE.

The HttpPutFormContentFilter is now deprecated.

Issue: SPR-16874
2018-06-04 15:48:47 -04:00
Rossen Stoyanchev a3216432b5 Polish
Issue: SPR-16387
2018-05-31 15:38:30 -04:00
Violeta Georgieva ffbc75ae47 Upgrade to Reactor Netty 0.8
Issue: SPR-16387
2018-05-31 15:37:39 -04:00
Juergen Hoeller 8593fec22c Avoid ConstantConditions warnings suppression (plus related polishing)
Issue: SPR-15756
2018-05-29 21:47:10 +02:00
Rossen Stoyanchev 2acf91a438 Polish 2018-05-26 09:24:23 -04:00
Juergen Hoeller 836a09d5c0 Upgrade to Woodstox 5.1, XMLUnit 2.6, Gson 2.8.5 2018-05-25 00:18:06 +02:00
Rossen Stoyanchev 2a993bf9ff 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:33:19 -04:00
Juergen Hoeller 285eb94a03 Upgrade to Hibernate Validator 6.0.10 2018-05-18 22:22:12 +02:00
Sebastien Deleuze 265960f09c Add StatusResultMatchers.isEqualTo Kotlin extension
Issue: SPR-16429
2018-05-15 15:37:47 +02:00
Rossen Stoyanchev 15182b29a4 Add MockWebSession for use with MockServerWebExchange
Issue: SPR-16772
2018-05-11 10:53:28 -04:00
Rossen Stoyanchev 4da43de7e1 Remove individual detection of forwarded headers
This commit removes all places where forwarded headers are checked
implicitly, on an ad-hoc basis.

ForwardedHeaderFilter is expected to be used instead providing
centralized control over using or discarding such headers.

Issue: SPR-16668
2018-05-11 09:31:39 -04:00
Rossen Stoyanchev d3f3b41f52 MockHttpServletResponse writer sets committed flag
Issue: SPR-16683
2018-05-10 16:22:54 -04:00
Rossen Stoyanchev eef592d901 Add builder to MockServerWebExchange
Issue: SPR-16772
2018-05-10 15:16:13 -04:00
Sam Brannen 7444a62f98 Test Spring-managed JUnit Jupiter extension 2018-05-09 13:34:30 +02:00
Juergen Hoeller 53aa9cc4cd Upgrade to Servlet API 4.0.1 (aligned with Tomcat 9 and Undertow 2)
Issue: SPR-16470
2018-05-07 14:17:28 +02:00
Arjen Poutsma 22edab852d Provide simple way to create ServerRequest
This commit introduces support for creating a new `ServerRequest` from
an existing instance. This is especially useful when filtering requests
in a HandlerFilterFunction.

Issue: SPR-16707
2018-05-02 10:54:00 +02:00
Sam Brannen 6fa1095e35 Upgrade to JUnit Jupiter 5.2 2018-04-30 11:21:26 +01:00
Juergen Hoeller d979bbad2d Expose AspectJ 1.9.1 in Maven POMs
Includes upgrade to Hibernate ORM 5.2.17 for integration tests.

Issue: SPR-16780
2018-04-27 19:33:50 +02:00
Juergen Hoeller a683472daa Support for non-standard HTTP status in reactive ClientHttpResponse
Issue: SPR-16748
2018-04-27 18:25:11 +02:00
Rossen Stoyanchev 9bc4e70e93 Better assertion message in MockPart
Issue: SPR-16767
2018-04-25 09:59:06 -04:00
Sam Brannen ae3fd49ebb Introduce non-transactional test for TestNG support 2018-04-23 16:18:02 +02:00
sdeleuze 568a0b5b79 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 15:00:04 +02:00
Sam Brannen c6ed41ec47 Suppress warning in SpringFailOnTimeoutTests 2018-04-14 15:02:57 +02:00
Sam Brannen 8317f12a9b Move SpringFailOnTimeoutTests to 'statements' package 2018-04-12 11:14:08 +02:00
Sam Brannen 4f3a7dd9b4 Expand scope of SpringFailOnTimeoutTests
Issue: SPR-16716
2018-04-12 10:56:40 +02:00
Igor Suhorukov 3c34a1cb8c Throw exception from user code in SpringFailOnTimeout even if a timeout occurs
Issue: SPR-16717
2018-04-12 10:37:13 +02:00
Sam Brannen 2523c3ab77 Clean up deprecation warning in spring-test 2018-04-11 12:03:55 +02:00
Arjen Poutsma 7e2726f400 Add remoteAddress() to ServerRequest
Issue: SPR-16681
2018-04-10 11:13:45 +02:00
Juergen Hoeller 9fbab791a0 Upgrade to TestNG 6.14.3, JUnit 5.1.1, Mockito 2.18 2018-04-10 00:12:28 +02:00
Rossen Stoyanchev 313308208e TestDispatcherServlet unwraps to find mock request
Issue: SPR-16695
2018-04-06 11:02:46 -04:00
Sam Brannen 56774baa2a Use Gradle 4.6's built-in support for the JUnit Platform
Gradle 4.6 provides built-in support for the JUnit Platform within the
standard `test` task.

This commit configures a custom `testJUnitJupiter` test task for
executing JUnit Jupiter tests directly on the JUnit Platform instead of
indirectly on JUnit 4 via @RunWith(JUnitPlatform.class).

This switch provides for better integration with Gradle's test reporting
and paves the way for a possible transition to the JUnit Platform in the
future.

Issue: SPR-16672
2018-04-04 15:43:44 +02:00
Sam Brannen 71cacff8c2 Upgrade to JUnit Jupiter 5.1
Issue: SPR-16408
2018-04-04 12:29:26 +02:00
Juergen Hoeller 28ea718d2d Build setup allows for JDK 10 as source/test target compatibility
Includes upgrade to Groovy 2.4.15 and HtmlUnit 2.30.

Issue: SPR-16390
2018-03-31 23:17:31 +02: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
Juergen Hoeller 9a27bc9b3e Upgrade to Jackson 2.9.5 and Hibernate Validator 6.0.9 2018-03-27 17:33:34 +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 c441d60d1d Upgrade to Kotlin 1.2.31 and RxJava 2.1.12
Includes H2 1.4.197 and Selenium HtmlUnit Driver 2.29.3 as well.
2018-03-24 16:48:53 +01:00
Juergen Hoeller b2f900e518 Upgrade to Hibernate ORM 5.2.16 and 5.1.13 2018-03-23 17:36:55 +01: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
Juergen Hoeller 99bb97388e Upgrade to Tomcat 8.5.29 and Selenium 3.11 2018-03-12 20:42:11 +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
Sam Brannen 00fea23e6b Introduce test for WebTestClient with RegEx-based JsonPath 2018-03-09 14:51:37 +01:00
Juergen Hoeller 2a3f90dc7b Upgrade to Hibernate ORM 5.2.15 and Hibernate Validator 6.0.8 2018-03-09 09:40:12 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Sam Brannen b14301bfba Allow TestContextManager to be compiled in Eclipse again 2018-03-07 17:44:24 +01:00
Sam Brannen 2454b31b30 Polish MockRestRequestMatchers[Tests] 2018-03-07 14:20:57 +01:00
Sam Brannen f932796201 Polishing 2018-03-07 13:22:36 +01:00
Sam Brannen fef0c7b151 Throw AssertionError instead of IAE in MockRestRequestMatchers 2018-03-07 13:22:21 +01:00
Yannik Hampe 4094879daf Make MockRestRequestMatchers independent of JUnit (#1720)
MockRestRequestMatchers was using org.junit.Assert.assertNotNull
and thus could not be used in projects that use e.g. TestNG instead
of JUnit 4.
2018-03-07 13:07:32 +01:00