Prior to this commit, active profiles were being added to the Spring Boot
application environment by setting the `spring.profiles.active` property.
This could result in profiles getting parsed differently than other uses of `@ActiveProfiles`.
Setting the profiles directly in the `Environment` prevents this parsing.
See gh-19556
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.
This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.
Fixes gh-18328
Previously, when spying on a scoped bean the creation of the spy
would be performed using the scoped proxy. This would result in
the spy being unable to spy on any of the target bean's methods as
the scoped proxy's implementations of those methods would be final.
This commit updates MockitoPostProcessor so that the creation of the
spy and injection of the @SpyBean-annotated field is performed using
the scoped target. The scoped target has not be proxied so this
allows Mockito to spy on all of its methods.
Closes gh-17817
Extend `JsonContentAssert` with `hasJsonPath` and `doesNotHaveJsonPath`
methods which can be used to check the path regardless of the value it
may or may not contain.
Prior to this commit there wasn't an easy way to assert that the
Jackson `@JsonInclude(JsonInclude.Include.NON_NULL)` annotation was
applied since `assertDoesNotHavePathValue` would pass for both
`{"name" : null}` and `{}`.
Closes gh-17608
Meta-annotate `ClassPathExclusions` and `ClassPathOverrides` with
so that the `ModifiedClassPathExtension` no longer needs to be
used directly.
See gh-17491
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.
Closes gh-7316
Broaden the scope of customizer support so that instead of focusing
just on headers, we can now customize any outgoing `HttpClientRequest`.
Also update auto-configuration to automatically add any
`RestTemplateRequestCustomizer` beans to the builder.
See gh-17091
Update `RestTemplateBuilder` so that it is easier to apply custom
headers to the outgoing request. The update is particularly useful
for setting the `User-Agent` header, for example so that a GitHub
username can be used when calling `api.github.com`.
See gh-17091
Reduce the surface area of the public API by making the
`BasicAuthentication` and `BasicAuthenticationClientHttpRequestFactory`
class package private.
This commit also attempts to simplify `TestRestTemplate` by keeping
the `RestTemplateBuilder` and reusing it, rather than needing to deal
only with a `RestTemplate` instance.
See gh-17010
Update `RestTemplateBuilder` to use a custom request factory to add
authentication headers rather than an interceptor.
Prior to this commit, the use of the `BasicAuthenticationInterceptor`
interceptor could cause `OutOfMemoryError` whenever a large file is
uploaded.
See gh-17010
Split the JUnit 5 `OutputCapture` class into separate `OutputExtension`
and `CapturedOutput` classes. The JUnit 5 callback methods are now
contained only in the `OutputExtension` class so no longer pollute the
public API that users will interact with.
The `CapturedOutput` class has also been updated to capture System.err
and System.out separately to allow distinct assertions if required.
Closes gh-17029
Previously, due to a quirk in Spring Framework, it was necessary to use bean method
proxying in @Configuration classes that define one or more FactoryBeans. This quirk has
now been addressed so this commit disables bean method proxying where it is now no longer
needed.
Closes gh-16533
The `spring-boot-test` module has a dependency to TestNG to validate
some part of the test infrastructure but no tests are actually written
using TestNG. The presence of TestNG is a trigger for the maven surefire
plugin and it attempts to run tests using it.
This commit defines the explicit provider to use (JUnit 4)
Closes gh-16735
Polish contribution to use a factory method in `AbstractJsonMarshalTester`
rather than additional constructor arguments.
Also change the `JsonContent` tests so that the `Configuration` constructor
is package private. This keeps JsonPath classes out of our public API, at
the expense of limiting custom JsonPath configurations to just our code.
See gh-16629
Update `JacksonTester` so that the JsonPath instance is explicitly configured
with both a `JacksonJsonProvider` and a `JacksonMappingProvider`.
Prior to this commit, the handling of special characters was not symmetrical
between the serialization (handled via the JacksonTester) and the parsing (handled
via JsonPath) due to the fact that JsonPath used `SimpleJson` as its parser.
See gh-16629
Rework `AbstractApplicationContextRunner.withBean` methods to
align signatures as much as possible with those provided by
the `ApplicationContext`.
Also update the implementation to use a dedicate member
variable rather than adding initializers.
Closes gh-16011
This commit adds `withBean` methods to the `ApplicationContextRunner`
abstraction so that simple beans can be registered inline. This is a
nice alternative for cases where a inner configuration class has to be
defined for the purpose of creating a simple bean.
Closes gh-16011
This commit migrates `AnnotationConfigReactiveWebApplicationContext`
parent to the `GenericApplicationContext` abstraction. Any use of
`AnnotationConfigWebApplicationContext` is also removed as it also
inherits from the `AbstractRefreshableApplicationContext` outdated
hierarchy.
A new `AnnotationConfigServletWebApplicationContext` context is
introduced instead, extending from `GenericApplicationContext` and
providing the counter part of the reactive context for the Servlet-based
web app tests.
See gh-16096