Commit Graph

617 Commits

Author SHA1 Message Date
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
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
Juergen Hoeller
3fc8ec498c MockHttpServletRequest returns a single InputStream or Reader
Issue: SPR-16505
Issue: SPR-16499
2018-06-13 22:03:16 +02: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
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
Rossen Stoyanchev
d3f3b41f52 MockHttpServletResponse writer sets committed flag
Issue: SPR-16683
2018-05-10 16:22:54 -04:00
Sam Brannen
7444a62f98 Test Spring-managed JUnit Jupiter extension 2018-05-09 13:34:30 +02:00
Sam Brannen
ae3fd49ebb Introduce non-transactional test for TestNG support 2018-04-23 16:18:02 +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
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
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
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
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
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
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
Sam Brannen
00fea23e6b Introduce test for WebTestClient with RegEx-based JsonPath 2018-03-09 14:51:37 +01:00
Juergen Hoeller
139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
Sam Brannen
2454b31b30 Polish MockRestRequestMatchers[Tests] 2018-03-07 14:20:57 +01:00
Juergen Hoeller
a0cc80063d Concurrency and exception message refinements for test transactions 2018-03-05 13:00:35 +01:00
Rossen Stoyanchev
e12fcca1e3 Fix failing test 2018-02-26 20:35:17 -05:00
Juergen Hoeller
01d9475bcc Turn registered controller classes into controller instances on the fly
Issue: SPR-16520
2018-02-25 14:29:44 +01:00
Rossen Stoyanchev
bb8cddda23 Assert instances (vs classes) in MockMvc/WebTestClient
Issue: SPR-16520
2018-02-21 14:01:53 -05:00
Juergen Hoeller
3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
igor-suhorukov
0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
Rossen Stoyanchev
1653a32a04 Stabilize Flux.interval emissions in integration tests
After this commit the use of interval in tests is combined with
take(n).onBackpressureBuffer(n) to ensure emissions don't fail if the
fixed rate is exceeded (e.g. on slow CI server).

Tests that verify N number of items followed by verifyOnComplete()
should set the number of emissions to N.

Tests that verify N number of items followed by thenCancel() should
set the number of buffered to an arbitrary number greater than N.
2018-02-06 11:01:19 -05:00
Rossen Stoyanchev
f20eacdb9b Polish 2018-02-02 15:06:59 -05:00
Rob Winch
0cd427bdd3 MockHttpServletRequestBuilder decodes pathInfo
Previously MockHttpServletRequestBuilder calculated the pathInfo from the
provided URL without decoding the value. This meant that the pathInfo
incorrectly included URL encoded values.

Now MockHttpServletRequestBuilder properly decodes the pathInfo.

Fixes: SPR-16453
2018-02-02 15:00:47 -05:00
Juergen Hoeller
b3e21ec737 MockHttpServletRequest leniently handles invalid Accept-Language header
Issue: SPR-16454
2018-02-02 11:34:22 +01:00
Sam Brannen
b612f53e27 Rename doesExist() to exists() for header assertions 2018-01-26 17:24:54 +01:00
Sam Brannen
165ca12e6d Add doesExist() to HeaderAssertions for WebTestClient 2018-01-25 15:50:19 +01:00
Sam Brannen
431494096a Polishing 2018-01-25 15:49:06 +01:00
Rossen Stoyanchev
49f1aa78eb Polish 2018-01-24 17:37:49 -05:00