Commit Graph

389 Commits

Author SHA1 Message Date
Phillip Webb
9e1c78da99 Update copyright year of changed files 2021-06-08 18:03:46 -07:00
weixsun
7f445630e4 Remove unnecessary semicolon
See gh-26446
2021-05-17 11:26:57 +01:00
Andy Wilkinson
be807bab12 Polish "Improve documentation of TestRestTemplate's fault tolerance"
See gh-26227
2021-05-17 11:07:42 +01:00
Carlos Rafael de Oliveira Carneiro
a6fa8addb9 Improve documentation of TestRestTemplate's fault tolerance
See gh-26227
2021-05-17 11:07:42 +01:00
Phillip Webb
26dd1b9a26 Update deprecations with for removal targets
Update all deprecation tags to include a removal target.

Closes gh-25808
2021-03-29 15:44:58 -07:00
Phillip Webb
82127fdaa3 Update copyright year of changed files 2021-03-23 12:50:49 -07:00
Andy Wilkinson
22b73f3020 Polish "Improve documentaion of Mockito test execution listeners"
See gh-25375
2021-03-05 14:14:36 +00:00
Andy Wilkinson
67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
2021-02-02 13:03:21 +00:00
Madhura Bhave
73a2a4b383 Consider context-path for WebTestClient baseUrl
Fixes gh-24168
2021-01-06 16:42:09 -08:00
dreis2211
0ec603cdad Avoid duplicates in MergedContextConfiguration
Remove duplicate config attribute classes by using a `Set` rather
than a `List` in the `SpringBootTestContextBootstrapper`.

See gh-24532
2020-12-16 12:50:54 -08:00
Phillip Webb
5f351a6983 Merge branch '2.2.x' into 2.3.x
Closes gh-24338
2020-12-04 18:21:57 -08:00
Phillip Webb
837fc83527 Fix checkstyle header violations
See gh-24337
2020-12-04 18:05:53 -08:00
Andy Wilkinson
dc86e8ce30 Merge branch '2.2.x' into 2.3.x
Closes gh-24012
2020-11-03 14:58:28 +00:00
Andy Wilkinson
6548ca4c11 Implement equals and hashCode in TestTypeExcludeFilter
Fixes gh-23978
2020-11-03 14:50:00 +00:00
Andy Wilkinson
a9a32f39b5 Merge branch '2.2.x' into 2.3.x
Closes gh-23671
2020-10-13 11:20:18 +01:00
Andy Wilkinson
667ccdae84 Simplify temp directory creation and improve diagnostics
Closes gh-23622
2020-10-13 11:18:06 +01:00
Andy Wilkinson
e626f7f47e Merge branch '2.2.x' into 2.3.x
Closes gh-23477
2020-09-24 14:45:55 +01:00
Andy Wilkinson
bf9d23e55a Consider SpringBootTest's web environment in context cache key
Previously, the web environment configured on `@SpringBootTest` was not
part of the context cache key. As a result, two test classes that has
identical configuration other than one using a MOCK web environment and
the other using a DEFINED_PORT web environment would share a context
when they should not do so. Classes that use MOCK and RANDOM_PORT were
not affected as the use of RANDOM_PORT results in a property for the
port being added to the environment.

This commit adds a new ContextCustomizer, SpringBootTestWebEnvironment,
that is used to capture the `webEnvironment` from `@SpringBootTest`
and use it in its hashCode and equals implementations. This fixes the
problem as all context customizers are evaluated when determing the
equality of two context cache keys.

Fixes gh-23085
2020-09-24 14:43:51 +01:00
Phillip Webb
4924573074 Merge branch '2.2.x' into 2.3.x 2020-08-06 10:15:22 -07:00
Phillip Webb
fdd6a89a61 Polish 2020-08-06 10:14:01 -07:00
Andy Wilkinson
39cb912819 Merge branch '2.2.x' into 2.3.x
Closes gh-22583
2020-07-27 13:08:14 +01:00
Andy Wilkinson
41954533b2 Fix Mock|SpyBean context caching
The fix for gh-20916 updated DefinitionsParser so that the
ResolvableType for each MockBean or SpyBean field included the
implementation class from which the field was found. Where the field
was declared with a variable generic signature that was made constant
by its implementation class, this allowed the correct concrete type to
be determined. It also had the unintended side-effect of preventing two
test classes with identical `@MockBean` and `@SpyBean` configuration
from sharing a context as the resolvable types for their mock and spy
bean fields would now be different.

This commit updates DefinitionsParser to only include the
implementation class in the ResolvableType if the field's generic type
is variable. For cases where it is not variable, this restores the
behaviour prior to the fix for gh-20916.

Fixes gh-22566
2020-07-27 13:04:02 +01:00
Phillip Webb
217b2eff89 Merge branch '2.2.x' into 2.3.x 2020-07-22 17:03:23 -07:00
Phillip Webb
b5e70157dc Update copyright year of changed files 2020-07-22 17:01:36 -07:00
Andy Wilkinson
f86831da9c Use TCCL at time of access for resource loading
Fixes gh-22119
2020-06-30 10:51:13 +01:00
Madhura Bhave
f4ad30c448 Merge branch '2.2.x' into 2.3.x
Closes gh-22006
2020-06-17 17:26:40 -07:00
Madhura Bhave
615cf63a82 Make MockBean resolve right type for abstract test class
Fixes gh-20916
2020-06-17 17:25:03 -07:00
Andy Wilkinson
0de466e06e Require dependency on s-b-dependencies to use its constraints
Previously, Spring Boot's modules published Gradle Module Metadata
(GMM) the declared a platform dependency on spring-boot-dependencies.
This provided versions for each module's own dependencies but also had
they unwanted side-effect of pulling in spring-boot-dependencies
constraints which would influence the version of other dependencies
declared in the same configuration. This was undesirable as users
should be able to opt in to this level of dependency management, either
by using the dependency management plugin or by using Gradle's built-in
support via a platform dependency on spring-boot-dependencies.

This commit reworks how Spring Boot's build uses
spring-boot-dependencies and spring-boot-parent to provide its own
dependency management. Configurations that aren't seen by consumers are
configured to extend a dependencyManagement configuration that has an
enforced platform dependency on spring-boot-parent. This enforces
spring-boot-parent's version constraints on Spring Boot's build without
making them visible to consumers. To ensure that the versions that
Spring Boot has been built against are visible to consumers, the
Maven publication that produces pom files and GMM for the published
modules is configured to use the resolved versions from the module's
runtime classpath.

Fixes gh-21911
2020-06-16 08:50:21 +01:00
Phillip Webb
0a05b4c9fd Update copyright year of changed files 2020-06-05 15:36:09 -07:00
Andy Wilkinson
daeca9f332 Restore Boot 2.2's compile-scoped dependencies
Fixes gh-21507
2020-06-03 12:55:11 +01:00
Phillip Webb
038ae93406 Update copyright year of changed files 2020-05-13 16:48:51 -07:00
Phillip Webb
49921d65ac Ensure @ActiveProfiles replaces existing profiles
Update `SpringBootContextLoader` to both add `spring.profiles.active`
properties and to directly call `Environment.setActiveProfiles`.
The additional `setActiveProfiles` call prevents `AbstractEnvironment`
from accidentally loading `spring.profiles.active` properties directly
when `doGetActiveProfiles` is called.

Directly setting active profiles has only become necessary since we
started adding properties using the square bracket notation. Previously
we added a comma-separated list which would be picked up by both the
`AbstractEnvironment` and the `ConfigurationFileApplicationListener`.

Closes gh-21302
2020-05-08 17:16:06 -07:00
Stephane Nicoll
846db6105f Merge branch '2.2.x'
Closes gh-21364
2020-05-08 14:51:49 +02:00
Stephane Nicoll
60ff8bafb5 Polish "Align TestRestTemplate Javadoc with documentation"
See gh-21318
2020-05-08 14:49:50 +02:00
Andrii Hrytsiuk
f11c030b71 Align TestRestTemplate Javadoc with documentation
See gh-21318
2020-05-08 14:48:21 +02:00
Phillip Webb
ad1248e4ec Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder"

Closes gh-21218
2020-04-28 19:20:24 -07:00
dreis2211
c7d7facc3a Remove empty test rule package
See gh-21137
2020-04-27 10:32:44 +02:00
Stephane Nicoll
c7baf5fda1 Update copyright year of changed file
See gh-21009
2020-04-25 08:55:27 +02:00
dreis2211
5eb5bf0a2d Polish
See gh-21009
2020-04-25 08:54:47 +02:00
Stephane Nicoll
85e9f713b0 Update copyright year of changed files
See gh-21007
2020-04-25 08:50:51 +02:00
Johnny Lim
29717423a3 Remove this keyword on member method invocations
See gh-21007
2020-04-25 08:49:44 +02:00
Phillip Webb
b73d5038d5 Merge branch '2.2.x' 2020-04-23 14:35:08 -07:00
Phillip Webb
9bb53a4c37 Polish 2020-04-23 14:31:49 -07:00
Madhura Bhave
b3ccefdb57 Merge branch '2.2.x'
Closes gh-21102
2020-04-23 10:19:10 -07:00
Madhura Bhave
4dc9bbe127 @SpringBootTest classes with different args shouldn't share a context
Fixes gh-20866
2020-04-23 10:18:14 -07:00
Madhura Bhave
21bb249a73 Merge branch '2.2.x'
Closes gh-21090
2020-04-22 14:36:36 -07:00
Madhura Bhave
b9c2b7b257 Prevent early initialization in MockitoPostProcessor
Fixes gh-20665
2020-04-22 14:35:50 -07:00
Phillip Webb
7ab2bca376 Support commas in @ActiveProfiles
Update `SpringBootContextLoader` so that it correctly deals with an
`@ActiveProfiles` annotation that contains a comma.

Fixes gh-19537

Co-authored-by: Scott Frederick <sfrederick@pivotal.io>
Co-authored-by: Andy Wilkinson <awilkinson@pivotal.io>
2020-04-17 18:47:56 -07:00
Phillip Webb
3ca896e63f Polish 2020-04-07 12:10:49 -07:00
Stephane Nicoll
f4c68dbc98 Do not set server.port=-1 for non embedded tests
Closes gh-16998
2020-04-02 18:12:39 +02:00