Commit Graph

196 Commits

Author SHA1 Message Date
Stephane Nicoll c8ac94b75d Polish contribution
Closes gh-8490
2017-03-10 09:51:35 +01:00
Roland Weisleder a6f0da8cc6 Introduce reset method to OutputCapture
Closes gh-8390
2017-03-10 09:48:36 +01:00
Spring Buildmaster d23fa24340 Next Development Version 2017-03-03 16:18:26 +00:00
Andy Wilkinson 545b29552d Merge branch '1.4.x' into 1.5.x 2017-02-28 15:58:08 +00:00
Andy Wilkinson 98cf35d48e Polish "Ignore spock.lang annotations when creating test context cache key"
See gh-8252
2017-02-28 15:55:55 +00:00
erlholmq 8f18df8a9c Ignore spock.lang annotations when creating test context cache key
See gh-7524
Closes gh-8252
2017-02-28 15:49:35 +00:00
Phillip Webb ca1540cefe Update header copyright for changed files 2017-02-27 20:41:18 -08:00
Phillip Webb 5867cd6175 Polish 2017-02-27 20:41:18 -08:00
Andy Wilkinson 8318177b0d Merge branch '1.4.x' into 1.5.x 2017-02-21 20:20:26 +00:00
Andy Wilkinson 70e802fba5 Use name from @SpyBean to disambiguate multiple candidates
Previously, @SpyBean's name attribute was not used when determining
the name of the bean to spy upon. When there were multiple candidates,
none of which were primary, this would lead to a failure to find the
bean to spy upon. This behaviour is also inconsistent with @MockBean
which does use the name attribute to identify the bean to mock.

This commit updates MockitoPostProcessor to use the name attribute,
when set, to identify the bean that should be spied upon. For
consistency with @MockBean it is always used when set. When not set
the previous logic will continue to be used.

Closes gh-8315
2017-02-21 20:19:50 +00:00
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
2017-02-06 10:35:13 +01:00
Andy Wilkinson b9b0cdb342 Merge branch '1.4.x' into 1.5.x 2017-02-02 13:48:19 +00:00
Andy Wilkinson 2f50d515a1 Apply root to URIs directly rather than relying on expansion
Previously, TestRestTemplate applied the root URI to URIs by
converting them to a String and then passing the String to the
RestTemplate delegate. Being a String, meant that the URI passed
through RestTemplate's standard URI template expansion processing
using the configured UriTemplateHandler. While this caused the root
URI to be applied, it also had the unwanted side-effect of
encoding the URI for a second time.

This commit updates TestRestTemplate so that, when configured with a
RootUriTemplateHandler, it applies the root URI directly and then
passes a modified URI to the RestTemplate delegate. Being a URI means
that no template expansion is performed and the possible double
encoding is avoided.

Closes gh-8163
2017-02-02 13:28:52 +00:00
Spring Buildmaster 5c12500366 Next Development Version 2017-01-30 20:10:13 +00:00
Spring Buildmaster a2696bf873 Next Development Version 2017-01-30 11:40:24 +00:00
Andy Wilkinson dd4051686b Remove empty test
The caching behaviour when using ImportAutoConfiguration is covered
by tests in spring-boot-test-auto-configuration, specifically by
ImportsContextCustomizerFactoryWithAutoConfigurationTests.

See gh-7953
2017-01-30 09:59:11 +00:00
Phillip Webb fa6a138598 Refine ImportsContextCustomizer cache logic
Update `ImportsContextCustomizer` so that whenever possible a more
specific cache key is used.

Prior to this commit the customizer would generate a key based on *all*
annotations on the test class. This has repeatedly caused issues where
test classes that should have the same cache key did not due to
unrelated annotations.

A new `DeterminableImports` interface has been added that can be
implemented by `ImportSelector` and `ImportBeanDefinitionRegistrar`
implementations that are able to determine their imports early. The
existing `ImportAutoConfigurationImportSelector` and
`AutoConfigurationPackages` classes have been retrofitted with
this interface.

Fixes gh-7953
2017-01-27 17:19:52 -08:00
Spring Buildmaster ed1ce140c0 Next Development Version 2017-01-26 14:20:39 +00:00
Stephane Nicoll 505e7f75ea Polish contribution
Closes gh-8089
2017-01-25 11:01:53 +01:00
dreis d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
2017-01-25 11:01:52 +01:00
Andy Wilkinson b71baf2c38 Support @ContextHierarchy when using @SpringBootTest
Closes gh-8000
2017-01-20 16:24:42 +00:00
Andy Wilkinson c31a2d8101 Merge branch '1.4.x' into 1.5.x 2017-01-19 11:03:33 +00:00
Andy Wilkinson 80a1e1ae64 Polishing 2017-01-19 11:03:18 +00:00
Andy Wilkinson 4e70cd2934 Merge branch '1.4.x' into 1.5.x 2017-01-19 10:58:34 +00:00
Andy Wilkinson b7a02e7237 Update TestRestTemplate to apply template handler to URIs
Previously, TestRestTemplate would only apply the UriTemplateHandler
to Strings and not to URIs. When using the auto-configured
TestRestTemplate, this prevented relative URIs from being
made absolute using LocalHostUriTemplateHandler.

The commit updates TestRestTemplate to turn URIs into Strings before
passing them to the delegate RestTemplate. Turning them into Strings
ensures that the delegate calls the UriTemplateHandler.

Closes gh-7891
2017-01-19 10:39:02 +00:00
Andy Wilkinson d2201d5284 Correct copyright dates and enforce that starting year is 2012
Closes gh-7923
2017-01-13 18:43:30 -05:00
Phillip Webb 0fca9aaccb Polish Mockito 2.0 support 2017-01-05 16:42:12 -08:00
Phillip Webb abb8e3663a Polish Mockito 2.0 support 2017-01-05 16:28:59 -08:00
Stephane Nicoll 6293033e1b Remove useless dependency 2017-01-05 14:21:59 +01:00
Phillip Webb fac6b8da47 Upgrade to JSONassert 1.4.0
Closes gh-7846
2017-01-05 00:00:07 -08:00
Johnny Lim f915ae197a Polish 2017-01-04 09:53:45 +01:00
Phillip Webb 8ccd4db513 Merge branch '1.4.x' into 1.5.x 2017-01-03 15:14:14 -08:00
Phillip Webb 556ce14f2d Fix TestRestTemplate.withBasicAuth interceptors
Update `TestRestTemplate` to handle `BasicAuthorizationInterceptor`s
correctly. Prior to this commit the `BasicAuthorizationInterceptor`
was added directly to the `ClientHttpRequestFactory` rather than
to the `RestTemplate`. This meant that it could not easily be removed
when `TestRestTemplate.withBasicAuth` was invoked.

The `TestRestTemplate` now sets the interceptor on `RestTemplate`
directly and relies on the logic in `InterceptingHttpAccessor` to
add it to the `ClientHttpRequestFactory`.

Fixes gh-7812
2017-01-03 15:12:30 -08:00
Phillip Webb 8b69856fc9 Polish 2016-12-28 15:23:26 -08:00
Stephane Nicoll 25bd0e0455 Do not reset server.port if a custom inline property is set
This commit allows to define `server.port` in a non-embedded web
environment. Previously, `server.port` would have been set to `-1`
regardless.

Closes gh-7353
2016-12-28 12:10:04 +01:00
Phillip Webb 884c9ef11e Remove accidentally committed file 2016-12-27 15:18:17 -08:00
Phillip Webb e0541d0f74 Polish 2016-12-27 14:48:44 -08:00
Stephane Nicoll 37519ecfef Merge branch '1.4.x' into 1.5.x 2016-12-25 10:00:33 +01:00
Stephane Nicoll 062104f1d6 Fix TestRestTemplate#patchFor methods visibility
Closes gh-7742
2016-12-25 10:00:20 +01:00
Spring Buildmaster 9057f9ae1f Next development version 2016-12-23 00:15:23 +00:00
Phillip Webb 765fd1dca0 Merge branch '1.4.x' into 1.5.x 2016-12-21 20:15:54 -08:00
Phillip Webb 138b96cf5f Use unique `testRestTemplate` bean name
Update `SpringBootTestContextCustomizer` to use the full qualified
TestRestTemplate as the registered bean name. Prior to this commit it
was possible that the customizer would replace the relatively common
bean name `testRestTemplate`.

Fixes gh-7711
2016-12-21 11:42:56 -08:00
Phillip Webb 73a45797c0 Merge branch '1.4.x' into 1.5.x 2016-12-19 18:45:35 -08:00
Phillip Webb 7824171413 Allow @SpyBean to work with @Primary beans
Update `MockitoPostProcessor` so that `@SpyBean` will automatically
pick the `@Primary` bean when multiple candidates exist.

Fixes gh-7621
2016-12-19 18:14:51 -08:00
Phillip Webb 87547f208a Add test for @SpyBean for generic bean definition
Add an integration test to check that @SpyBean can be used with on a
bean definition that returns a generic type.

Closes gh-7625
2016-12-19 15:58:25 -08:00
Phillip Webb 4b9cba351b Merge branch '1.4.x' into 1.5.x 2016-12-19 12:36:57 -08:00
Phillip Webb bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Stephane Nicoll 28e86272e8 Merge branch '1.4.x' into 1.5.x 2016-12-19 11:30:56 +01:00
Stephane Nicoll 863f97dc11 Polish since version
Closes gh-7412
2016-12-19 11:30:38 +01:00
Andy Wilkinson 367de7bf71 Add support for new PATCH methods to TestRestTemplate
Closes gh-7412
2016-12-19 11:27:10 +01:00