Commit Graph

399 Commits (aa52c1763f217a1db1ef54c44971de81110ca34d)

Author SHA1 Message Date
Andy Wilkinson 21de3fba3c Describe quirks of JUL and Log4j2 in OutputCaptureExtension javadoc
Closes gh-32562
1 year ago
Andy Wilkinson f4c996b432 Polish "Check for Class and ResolvableType object type attributes"
See gh-36224
1 year ago
Bernardo Bulgarelli 3a7185206e Check for Class and ResolvableType object type attributes
See gh-36224
1 year ago
Phillip Webb 5d0640a356 Use MergedAnnotations for `@AliasFor` support
Update `ImportsContextCustomizer` to use `MergedAnnotations` so
that `@AliasFor` can be supported.

See gh-34917
1 year ago
Andy Wilkinson 6dc84b1645 Ignore non-singleton factory beans when resetting mocks
Closes gh-35324
2 years ago
Mortitz Halbritter bece347987 Polish 2 years ago
Phillip Webb df5898a146 Reformat code following spring-javaformat upgrade 2 years ago
Andy Wilkinson 9940fcfe77 Reset mocks produced by FactoryBeans
An unwanted side-effect of the changes made in c6bdd136 to fix
gh-7271 is that a mock produced by a factory bean is not reset. To
allow such a mock to be reset without regressing the fix we now call
getBean(…) as we did before c6bdd136, however the call is now
performed in a defensive manner falling back to getSingleton(…) when
it fails.

Closes gh-33830
2 years ago
Phillip Webb 7c508fa324 Update copyright year of changed files 2 years ago
Moritz Halbritter e8d809fe65 Replace 'via' with 'over' or 'through' in the documentation
Closes gh-33878
2 years ago
Phillip Webb a0fe8241a7 Update copyright year of changed files 2 years ago
Moritz Halbritter d652491e20 Fix stack overflow in SpringBootMockResolver
Closes gh-32632
2 years ago
Andy Wilkinson 6bf35e3dd0 Merge branch '2.6.x' into 2.7.x
Closes gh-33262
2 years ago
Andy Wilkinson 0c8ae65bd4 Switch of the banner when SpringBootTest runs an app with a parent
Closes gh-33079
2 years ago
Phillip Webb c8676a81de Merge branch '2.6.x' into 2.7.x 2 years ago
Phillip Webb d7ac20cd6c Update copyright year of changed files 2 years ago
Phillip Webb 0f4d98b1f4 Merge branch '2.6.x' into 2.7.x
Closes gh-32575
2 years ago
Phillip Webb e917bd0ed0 Only build OutputCapture strings when necessary
Update `OutputCapture` so that expensive build operations are only
performed when necessary. This update is especially important for Kotlin
users calling `"Expected String" in output` since this results in a call
to Kotlin's `CharSequence.contains` which calls the `length()` and
`charAt()` methods many times.

Closes gh-32033
2 years ago
Phillip Webb a4ef6a7c5c Merge branch '2.6.x' into 2.7.x
Closes gh-31865
2 years ago
Phillip Webb f8412847dc Update copyright year for "Fix typos in code and documentation"
See gh-31734
2 years ago
Marc Wrobel dbfc6bded4 Fix typos in code and documentation
See gh-31734
2 years ago
Andy Wilkinson b3a4982f31 Merge branch '2.6.x' into 2.7.x
Closes gh-31174
3 years ago
Andy Wilkinson cbf42dea14 Update deprecation messages to change removal version from 2.8 to 3.0
Closes gh-30903
3 years ago
Andy Wilkinson 7789a18d23 Merge branch '2.6.x' into 2.7.x
Closes gh-30667
3 years ago
Andy Wilkinson d4348279a7 Merge branch '2.5.x' into 2.6.x
Closes gh-30666
3 years ago
Andy Wilkinson 8f1b8622ba Ensure that webEnvironment=NONE creates non-web context
Previously, if spring.main.web-application-type was configured in
application.properties to servlet or reactive, setting
webEnvironment=NONE on @SpringBootTest would not work correctly and
a servlet or reactive web application context would be created
based on the value of spring.main.web-application-type.

This commit updates the test context bootstapper to set
spring.main.web-application-type to none when webEnvironment has been
set to none. This is done in the merged context configuration's
property source properties which are applied to the environment in a
high-precedence test property source that will override configuration
in application.properties.

Closes gh-29695
3 years ago
Andy Wilkinson 4545d39603 Merge branch '2.6.x' into 2.7.x
Closes gh-30665
3 years ago
Andy Wilkinson 887fa4a13f Merge branch '2.5.x' into 2.6.x
Closes gh-30664
3 years ago
Andy Wilkinson c8de843d85 Honor final web application type when creating context in tests
Previously, SpringBootContextLoader would configure its
SpringApplication with an ApplicationContextFactory that ignores
the WebApplicationType with which its called and instead returns a
hard-coded type of context based on the type of the
MergedContextConfiguration. This hard-coding would result in the
wrong type of context being used if a subsequent change was made to
the application's WebApplicationType, for example due to binding of
the spring.main.web-application-type configuration property.

This commit updates SpringBootContextLoader to configure
SpringApplication with an ApplicationContextFactory that takes the
WebApplicationType with which it is called into consideration.

Fixes gh-29170
3 years ago
Andy Wilkinson 48f8021d88 Migrate @Local*Port annotations to spring-boot-test
Closes gh-29589
3 years ago
Andy Wilkinson bcb71dfd1b Merge branch '2.6.x' into 2.7.x
Closes gh-30383
3 years ago
Andy Wilkinson 1244c429a6 Merge branch '2.5.x' into 2.6.x
Closes gh-30382
3 years ago
Andy Wilkinson e927cd71dd Clarify type matching performed by MockBean and SpyBean
Closes gh-28656
3 years ago
Brian Clozel 81754c8bc4 Upgrade to Spring GraphQL 1.0.0-SNAPSHOT
This commit switches to 1.0.0-SNAPSHOT for Spring GraphQL, before its
upcoming 1.0.0-M6 version.

This commit adapts to the changes introduced in
spring-projects/spring-graphql#317 : now that `GraphQlClient` has been
introduced, `GraphQlTester` has been aligned with the new
infrastructure. The `@GraphQlTest` and `@SpringBootTest` testing support
is now using different variants for each.

All samples have been updated to use the proper GraphQL terminology, see
and spring-projects/spring-graphql#310 .

See gh-29637
3 years ago
Andy Wilkinson 5f2ae858b6 Merge branch '2.6.x' into 2.7.x
Closes gh-29910
3 years ago
Andy Wilkinson 95d67a985b Merge branch 'gh-29639' into 2.6.x
Closes gh-29909
3 years ago
Andy Wilkinson 5baa71f1b3 Allow beans with circular dependencies to be spied
Closes gh-29639
3 years ago
Andy Wilkinson 9a3f053034 Allow beans with circular dependencies to be spied
Closes gh-29639
3 years ago
Phillip Webb 9764b3eba0 Change getEnvironment() to return null by default
Update the `SpringBootContextLoader.getEnvironment()` method so that it
returns `null` rather than a new `StandardEnvironment`.

Closes gh-29405
3 years ago
Phillip Webb c84d3c14fb Allow test property sources to override command line args
Refine `SpringBootContextLoader` logic so that inline test properties
are always added above command line arguments.

Closes gh-29404
3 years ago
Phillip Webb 9278a502c7 Merge branch '2.6.x' into 2.7.x 3 years ago
Phillip Webb 14fe9347b5 Merge branch '2.5.x' into 2.6.x 3 years ago
Phillip Webb 3f7bf7d34f Modify SpringApplication Environment rather than setting it
Update `SpringBootContextLoader` so that when possible the
`SpringApplication` remains in control of creating the `Environment`
instance.

Prior to this commit, we would always create the `Environment` in the
`SpringBootContextLoader` and then call `setEnvironment` on the
`SpringApplication`. This meant that the `ApplicationEnvironment`
classes were not used and that `isCustomEnvironment` was set to `true`
so no conversion was applied.

With the updated code, an `ApplicationListener` is used to mutate the
`Environment` instance and add the required test property sources.

Fixes gh-29169
3 years ago
Phillip Webb fee45e056a Merge branch '2.6.x' into 2.7.x
Closes gh-29375
3 years ago
Phillip Webb 91d2b1b988 Merge branch '2.5.x' into 2.6.x
Closes gh-29374
3 years ago
Phillip Webb eb6b48fff0 Use side-effect free environment with tests rather than converting
Refine the logic introduced in 64270eca to use a side-effect free
Environment implementation rather than converting the Environment early.

Early conversion can cause condition evaluation issues if
`src/test/resources/application.properties` files are bound to the
`SpringApplication`. Specifically the `spring.main.web-application-type`
property can change the `Environment` type which must happen before
conditions are evaluated.

Fixes gh-29169
3 years ago
Phillip Webb b25e92f3e2 Merge branch '2.6.x' into 2.7.x 3 years ago
Brian Clozel 0d616b8924 Fix WebGraphQlTester auto-registration for SpringBootTest
Prior to this commit, the `GraphQlTesterContextCustomizer` would
register a `WebGraphQlTester` instance as a `GraphQlTester` bean., only
exposing the `GraphQlTester` type. This is not in line with the
documentation and also does not register the bean definition with the
most specific type.
With this issue, a `@SpringBootTest` integration test will not be
injected with a `WebGraphQlTester` if it asks one.

This commit ensures that the `WebGraphQlTester` is registered as such
and that all related classes are renamed as a result.

Fixes gh-29250
3 years ago
Stephane Nicoll 2b140950e3 Merge branch '2.6.x' into 2.7.x
Closes gh-29176
3 years ago
izeye 7fbb5749d1 Polish
See gh-29157
3 years ago