302 Commits

Author SHA1 Message Date
Aleksander Bartnikiewicz
eb927f1b29 Prevent a broken factory bean from breaking the resetting of mocks
Closes gh-7271
2016-11-25 10:39:30 +00:00
Phillip Webb
e0dfff2b23 Merge branch '1.5.x' 2016-11-22 14:54:17 -08:00
Phillip Webb
88c84ce234 Merge branch '1.4.x' into 1.5.x 2016-11-22 14:53:30 -08:00
Phillip Webb
a3b79be6b3 Support @MockBean on FactoryBeans
Update @MockBean support so that FactoryBean classes can be mocked.

Fixes gh-7439
2016-11-22 13:49:28 -08:00
Phillip Webb
1452d3cd51 Ensure withBasicAuth keeps error handler
Fix `TestRestTemplate` so that any custom `ErrorHandler` isn't lost
when calling `withBasicAuth`.

Fixes gh-7441
2016-11-22 10:58:30 -08:00
Phillip Webb
20d7dd5747 Merge branch '1.5.x' 2016-11-18 17:30:03 -08:00
Phillip Webb
1657120286 Move ModifiedClassPathRunner to its own module
Migrate `ModifiedClassPathRunner` from `spring-boot` test source to
its own module.

Fixes gh-7420
2016-11-18 17:27:54 -08:00
Andy Wilkinson
9ec38dc8c1 Merge branch '1.5.x' 2016-11-18 16:57:02 +00:00
Andy Wilkinson
f35fa87366 Fix problems in SpringBootMockUtil reported by Checkstyle 2016-11-18 16:56:36 +00:00
Andy Wilkinson
9273b1789b Merge branch '1.5.x' 2016-11-18 16:41:22 +00:00
Andy Wilkinson
1cd781b242 Make spring-boot-test compatible with Mockito 2.1 and 2.2
We use some internal Mockito classes and some  breaking API changes
have been made to them in Mockito 2. This commit introduces a utility
class, SpringBootMockUtil, to shield our code from these differences.
Mockito 1 is called directly and Mockito 2 is called via reflection.

To allow these changes to be tested, FilteredClassPathRunner has been
enhanced to also support overriding a dependency on the class path.
As a result it has been renamed to ModifiedClassPathRunner. The new
ClassPathOverrides annotation can be used to provide the Maven
coordinates of one or more dependencies that should be resolved and
added to the class path. Such additions are added to the start of
the class path so that they override any existing dependency that
contains the same classes.

Closes gh-6520
2016-11-18 16:39:44 +00:00
Andy Wilkinson
6361a6728a Add support for new PATCH methods to TestRestTemplate
Closes gh-7412
2016-11-17 19:51:16 +00:00
Phillip Webb
cb7c0b5031 Merge branch '1.5.x' 2016-11-16 16:06:53 -08:00
Phillip Webb
7daf69a393 Upgrade to HTMLUnit 2.23 (+selenium module 2.23.2)
Fixes gh-7232
2016-11-16 15:30:34 -08:00
Spring Buildmaster
e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Stephane Nicoll
e509278580 Merge branch '1.5.x' 2016-10-24 11:39:38 +02:00
Stephane Nicoll
eddb10e4c9 Merge branch '1.4.x' into 1.5.x 2016-10-24 11:39:26 +02:00
Stephane Nicoll
4603d8259a Make MockitoTestExecutionListener public
Closes gh-7016
2016-10-24 11:37:20 +02:00
Andy Wilkinson
86034e5c5c Merge branch '1.5.x' 2016-10-19 12:22:23 +01:00
Andy Wilkinson
3ea09d2e04 Merge branch '1.4.x' into 1.5.x 2016-10-19 12:22:11 +01:00
Andy Wilkinson
02e89acd1e Add managed version for kotlin-runtime to spring-boot-parent
See gh-7101
2016-10-19 12:20:37 +01:00
Andy Wilkinson
b1026db330 Merge branch '1.5.x' 2016-10-19 12:09:46 +01:00
Andy Wilkinson
f942fe4947 Merge branch '1.4.x' into 1.5.x 2016-10-19 12:09:35 +01:00
Andy Wilkinson
64d32191cf Ignore Kotlin annotations when creating test context cache key
Every classes that's compiled by Kotlin is annotated with
kotlin.Metadata. The attributes of this annotation always differ so
if they are used in the cache key, context caching will effectively
be disabled.

This commit updates the key used by ImportsContextCustomizer to
ignore the kotlin.Metadata annotation. Additionally, to align with
with Java where annotations in java.lang.annotation are ignored,
annotations in kotlin.annotation are also ignored.

Closes gh-7101
2016-10-19 12:03:33 +01:00
Phillip Webb
01900c8342 Merge branch '1.5.x' 2016-10-11 23:42:14 -07:00
Phillip Webb
d3e06c4627 Merge branch '1.4.x' into 1.5.x 2016-10-11 21:46:06 -07:00
Phillip Webb
db3f488d5a Polish 2016-10-11 17:54:00 -07:00
Phillip Webb
53f50eda39 Merge branch '1.5.x' 2016-10-03 22:47:11 -07:00
Phillip Webb
f2b0fa284e Merge branch '1.4.x' into 1.5.x 2016-10-03 22:38:22 -07:00
Madhura Bhave
16fe332f51 Fix NoClassDefFoundError when Mockito is missing
Update MockReset class to check for the presence of the MockUtil class
before attempting to use it.

Fixes gh-7065
2016-10-03 22:27:20 -07:00
Phillip Webb
3326841a97 Formatting 2016-10-03 22:19:35 -07:00
Phillip Webb
f59cc25e2b Fix eclipse warnings 2016-10-03 21:51:16 -07:00
Stephane Nicoll
b95b57dbf5 Merge branch '1.5.x' 2016-10-02 11:08:53 +02:00
Stephane Nicoll
e643fc5bd1 Merge branch '1.4.x' into 1.5.x 2016-10-02 11:08:33 +02:00
Johnny Lim
503d735fdd Polish
Closes gh-7081
2016-10-02 11:07:04 +02:00
Stephane Nicoll
49a606fa91 Merge branch '1.5.x' 2016-09-28 17:00:56 +02:00
Stephane Nicoll
cdd59707fc Merge branch '1.4.x' into 1.5.x 2016-09-28 17:00:30 +02:00
Johnny Lim
30a677646f Polish
Closes gh-7030
2016-09-28 16:45:19 +02:00
Andy Wilkinson
0cdbbd49b5 Address warnings caused by deprecations in Spring Framework 5
See gh-6977
2016-09-21 17:34:54 +01:00
Stephane Nicoll
6643ec3713 Next development version 2016-09-21 17:05:50 +02:00
Stephane Nicoll
ce1e41dce3 Remove deprecated code
This code removes code deprecated in 1.4 with the exception of code that
requires an update to Spring Framework 5.

Closes gh-6971
2016-09-21 14:30:28 +02:00
Stephane Nicoll
6bd670edbc Initiate 1.4.x branch 2016-09-21 11:11:24 +02:00
Spring Buildmaster
7e9ed5e1a7 Next Development Version 2016-09-21 07:58:07 +00:00
Stephane Nicoll
111743275f Polish 2016-09-19 15:17:27 +02:00
Johnny Lim
a994b11a73 Polish 2016-09-18 23:38:21 -07:00
Eddú Meléndez
bc55b6e0d4 Add contextPath LocalHostUriTemplateHandler URIs
Update `LocalHostUriTemplateHandler` so that the `server.context-path`
property is also considered when building the URL.

Fixes gh-6904
Closes gh-6919
2016-09-17 19:33:06 -07:00
Phillip Webb
aad40093ff Make Mock/Spy qualifiers part of context cache key
Refine @MockBean/@SpyBean qualifier support so that qualifiers form part
of the context cache key. Prior to this commit is was possible that two
different tests could accidentally share the same context if they
defined the same @Mock but with different @Qualifiers.

See gh-6753
2016-09-17 18:43:43 -07:00
Phillip Webb
04448d6bd9 Polish 2016-09-17 18:43:43 -07:00
Stephane Nicoll
3f236dc951 Support Qualifiers on MockBean and SpyBean
Previously, if an injection point used a qualifier, `MockBean` and
`SpyBean` couldn't be used to mock/spy it as there was no way to
specify that qualifier information.

This commit now detects qualifier information on the injection point
and associate it with the created `BeanDefintion`. If one wants to
mock a bean that is qualified with `@Qualifier("foo")`, the definition
of the mock should be as follows:

```
public class MyTest {

	@MockBean
	@Qualifier("foo")
	private ExampleService service;
}
```

As a side effect, it is now possible to mock a service by type even if
there are multiple instances of that type in the application context. The
provided qualifier information is used to determine the right candidate
and the proper bean definition is replaced accordingly.

Closes gh-6753
2016-09-16 11:17:23 +02:00
Phillip Webb
25c4e261e9 Fix failing tests
See gh-6897
2016-09-15 17:16:26 -07:00