203 Commits

Author SHA1 Message Date
Stephane Nicoll
52b80c77d8 Merge branch '2.0.x' 2018-05-29 10:39:39 +02:00
nkjackzhang
17bcd1c359 Fix wrong reference in cast operation
Closes gh-13288
2018-05-29 10:37:32 +02:00
Stephane Nicoll
7462401291 Merge branch '2.0.x' 2018-05-28 09:28:30 +02:00
Eddú Meléndez
065eebfb4b Fix javadoc
Closes gh-13274
2018-05-28 09:26:16 +02:00
Stephane Nicoll
4464a5f5bd Remove code deprecated in 2.0
Closes gh-12962
2018-05-22 14:48:25 +02:00
Phillip Webb
2dc4f1df00 Polish 2018-05-21 21:32:42 -07:00
Stephane Nicoll
300f6bf4d7 Polish contribution
Closes gh-13208
2018-05-18 14:20:31 +02:00
Mihhail Lapushkin
d31dbac69e Support custom UriTemplateHandler in LocalHostUriTemplateHandler
See gh-13208
2018-05-18 14:19:01 +02:00
Phillip Webb
5b3cb8a698 Update copyright header year for changed files 2018-05-04 15:59:26 -07:00
Phillip Webb
6e09e497f2 Formatting 2018-05-04 12:06:19 -07:00
Phillip Webb
2d70a7ae5e Polish caught exception names
Prefer `ex` over `e`.
2018-05-03 22:43:32 -07:00
Phillip Webb
41efea51a7 Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the
the check.
2018-05-03 22:43:12 -07:00
Phillip Webb
e125085993 Merge branch '1.5.x' into 2.0.x 2018-05-03 12:43:50 -07:00
Johnny Lim
f03849d502 Polish
See gh-12812
2018-04-10 11:46:16 +02:00
igor-suhorukov
4c61d8abfe avoid check class by string name 2018-03-14 23:59:42 +01:00
Stephane Nicoll
ed05e1f7ca Polish "Reorder modifiers to comply with the JLS"
Closes gh-12432
2018-03-12 15:17:23 +01:00
igor-suhorukov
aebb475bc5 Reorder modifiers to comply with the JLS
See gh-12432
2018-03-12 15:17:05 +01:00
igor-suhorukov
98f4692c62 Polish
This commit changes invocations to immediately return the expression
instead of assigning it to a temporary variable. The method name should
be sufficient for callers to know exactly what will be returned.

Closes gh-12211
2018-02-25 10:59:02 +01:00
Phillip Webb
4b9c3c137e Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray`
or zero length when converting collections to arrays.

Fixes gh-12160
2018-02-22 21:11:30 -08:00
Johnny Lim
680287635c Rename TestRestTemplateTestContextCustomizer*
Closes gh-12182
2018-02-22 20:26:14 -08:00
Phillip Webb
cd5266ac03 Polish 2018-02-22 20:25:28 -08:00
Johnny Lim
2fe86da95b Use isTrue() and isFalse() for AssertJ
Closes gh-12170
2018-02-22 09:55:40 +01:00
igor-suhorukov
fe023817c7 Polish static finals
Closes gh-12083
2018-02-19 20:10:58 -08:00
Johnny Lim
88b184ca23 Polish 2018-02-19 20:00:20 -08:00
Phillip Webb
9e75680e6f Polish 2018-02-16 18:11:54 -08:00
Brian Clozel
db7268b841 Fix TestRestTemplate request factory management
This commit fixes two issues in `TestRestTemplate`:

* it improves the detection of the underlying request factory, using
reflection to look inside the intercepting request factory if
interceptors were configured

* it avoids reusing the same request factory when creating a new
`TestRestTemplate` with `withBasicAuth`. Sharing the same instance would
result in sharing authentication state (HTTP cookies). Since the
original request factory can't be detected consistently, a new one is
selected automatically

See gh-8697
2018-02-16 22:36:20 +01:00
Brian Clozel
03a6f97e76 TestRestTemplate should not override request factory
Previously `TestRestTemplate` would override the configured
`ClientHttpRequestFactory` if the Apache HTTP client library was on
classpath.

This commit fixes two issues:

1. The existing `ClientHttpRequestFactory` is overridden *only* if it is
using the Apache HTTP client variant, in order to wrap it with the
`TestRestTemplate` custom support

2. Calling `withBasicAuth` will no longer directly use the request
factory returned by the internal `RestTemplate`; if client interceptors
are configured, the request factory is wrapped with an
`InterceptingClientHttpRequestFactory`. If we don't unwrap it,
interceptors are copied/applied twice in the newly created
`TestRestTemplate` instance. For that, we need to use reflection as the
underlying request factory is not accessible directly.

Closes gh-8697
2018-02-16 12:29:47 +01:00
Phillip Webb
728b522307 Include scope support on ApplicationContextAssert
Update `ApplicationContextAssert` with support for scopes. Allows
tests to consider the all ancestors, or limit assertions to just the
current context.

Fixes gh-12015
2018-02-12 17:49:54 -08:00
Phillip Webb
7ab587a067 Add initializer support
Add `ApplicationContextInitializer` support to
`ApplicationContextRunner`.
2018-02-12 17:49:53 -08:00
Phillip Webb
0348889fd7 Polish 2018-02-12 10:03:06 -08:00
Brian Clozel
2be0c46562 Remove TestRestTemplate constructors taking template args
As discussed in gh-11872, `TestRestTemplate` constructor variants taking
a `RestTemplate` argument are confusing since the main goal of that
class is to mutate `RestTemplate`.

This commit removes all those constructor variants and replaces them
with `RestTemplateBuilder` arguments when possible.

Closes gh-11872
2018-02-12 16:57:15 +01:00
Andy Wilkinson
76a450dfba Format with Eclipse Oxygen SR2 2018-02-08 10:53:53 +00:00
Andy Wilkinson
37f3b1d1e5 Polish 2018-02-08 10:10:34 +00:00
Andy Wilkinson
b3ed46af5a Polish 2018-02-07 16:30:03 +00:00
Phillip Webb
7ea6af0e46 Make AbstractApplicationContextRunner public
Fixes gh-11929
2018-02-06 13:28:18 -08:00
Andy Wilkinson
886f782b20 Merge branch '1.5.x' 2018-02-05 11:04:48 +00:00
Phillip Webb
69234f8c08 Polish 2018-02-02 18:59:05 -08:00
Andy Wilkinson
875091ed85 Polish “Remove or use unused method parameters”
Closes gh-11812
2018-02-02 09:34:19 +00:00
igor-suhorukov
717bd2c580 Remove or use unused method parameters 2018-02-02 09:34:19 +00:00
Phillip Webb
706aa7af59 Make getInitializers() a protected method
Update `SpringBootContextLoader` so that `getInitializers()` is now a
protected method for subclasses to override if necessary.

Closes gh-11457
2018-02-01 12:24:11 -08:00
Andy Wilkinson
458dde63a8 Explicitly order AbstractTestExecutionListener subclasses
By default, AbstractTestExecutionListeners have an order of lowest
precedence. This means that it is impossible to write a listener with
lower precedence that any listener that's using the default order.

This commit updates Boot's 6 AbstractTestExecutionListeners to order
them explicitly. MockitoTestExecutionListener performs injection of
Mockito mocks and spies into the test instance. It now has an order of
2050 giving it slightly lower precedence than the dependency injection
test execution listener (2000).

The remaining 5 listeners have all been ordered with lowest precedence
- 100. This leaves them near their current lowest precedence position
while creating some room for any listeners that require lower
precedence.

Closes gh-11796
2018-02-01 14:28:25 +00:00
dreis2211
a7663c88d3 Replace casted Mockito.any() calls
Closes gh-11817
2018-01-29 07:50:29 +01:00
Jon Schneider
fd237f85cc Extract common micrometer test setup
Create `MetricsRun` that can be used to apply common micrometer test
configuration to a `ApplicationContextRunner`.

Closes gh-11804
2018-01-26 14:42:22 -08:00
Phillip Webb
b7c52da457 Allow custom WebTestClient beans
Update `@SpringBootTest` `WebTestClient` support so that the bean
definition is only registered when the user has not defined or
auto-configured their own.

See gh-10556
2018-01-25 00:08:19 -08:00
Phillip Webb
177281a504 Allow custom TestRestTemplate beans
Update `@SpringBootTest` `TestRestTemplate` support so that the bean
definition is only registered when the user has not defined or
auto-configured their own.

See gh-10556
2018-01-25 00:08:19 -08:00
Phillip Webb
ab6ad6aa4b Polish 2018-01-24 16:09:14 -08:00
andrey.onufreyko
b19dcb13e2 Replace string arguments with char
Optimize method calls by replacing single character String arguments
with char.

Closes gh-11680
2018-01-22 16:35:06 -08:00
Stephane Nicoll
c926bed6f5 Polish "Fix modifiers order"
Closes gh-11681
2018-01-19 11:30:30 +01:00
igor-suhorukov
e2d05607f2 Fix modifiers order
See gh-11681
2018-01-19 11:30:06 +01:00
Phillip Webb
f3379668ac Polish 2018-01-18 23:21:51 -08:00