Spring Framework 5 will support Jsonb as a HttpMessageConverter, this
commit adds auto-configuration support. Also, support for Jsonb in the
@JsonTest has been added.
This implementation is running against Apache Johnzon
See gh-9648
Previously, TestTypeExcludeFilter only looked for JUnit 4 class
and method annotations when determining if a class was a test class.
As a result, if an application was using JUnit Jupiter, its test
classes would not be exluded during component scanning.
This commit expands TestTypeExcludeFilter to also identify classes
using JUnit Jupiter. This includes classes (meta-)annotated with
@ExtendWith and methods (meta-)annotated with @Testable. The later
provides detection of Jupiter's @Test, @TestFactory, and @RepeatedTest
annotations all of which are meta-annotated with @Testable.
Closes gh-6898
This commit makes the "spring.session.store-type" property optional,
adding an additional check when it is not present that validates only
one supported implementation is available on the classpath.
As Spring Session has been modularized, the chance that multiple
implementations are available on the classpath are lower. When only
one implementation is present, we attempt to auto-configure it. When
more than one implementation is present and no session store is
configured, a NonUniqueSessionRepositoryException is thrown.
Closes gh-9863
Restructure actuator packages to improve structure. The following
changes have been made:
- Separate actuator and actuator auto-configuration into different
modules.
- Move endpoint code into `spring-boot-actuator`.
- Move `Endpoint` implementations from a single package into
technology specific packages.
- Move `HealthIndicator` implementations from a single package into
technology specific packages.
- As much as possible attempt to mirror the `spring-boot` package
structure and class naming in `spring-boot-actuator` and
`spring-boot-actuator-autoconfigure`.
- Move `DataSourceBuilder` and DataSource meta-data support from
`spring-boot-actuator` to `spring-boot`.
Fixes gh-10261
Rename `ApplicationContextTester` and related classes to
`ApplicationContextRunner` and refactor existing tests to use correctly
named variables.
See gh-9875
Previously, JsonContentAssert returns AbstractMapAssert from
extractingJsonPathMapValue. This could lead to type safety warnings
when calling one of the assert's methods with a generic varargs
parameter such as
contains(Entry<? extends Object, ? extends Object>...).
This commit replaces the use of both AbstractMapAssert and
AbstractListAssert with MapAssert and ListAssert respectively. These
classes use final methods and @SafeVargs args to prevent the
above-described problem from occurring.
See gh-9675
Rename `ContextLoader` to `ApplicationContextTester` and provide
distinct subclasses for standard, web and reactive application contexts.
Context callbacks now return AssertJ compatible contexts, allowing
tests to run directly on context. For example:
context.run((loaded) -> assertThat(loaded).hasBean("foo"));
The returned context can now also represent a context that has failed
to start (meaning that the `loadAndFail` methods are no longer needed):
context.run((loaded) -> assertThat(loaded).hasFailed());
Configuration classes are loaded via the recently introduced
`Configurations` class. This means that the tester no longer needs to
be directly aware of auto-configuration concepts.
See gh-9634
Update `TestPropertyValues` so that it can also be used to update
system properties. Properties are set before the call is made and
restored to their previous value afterwards.
Fixes gh-9792
This commit applies what's been done in gh-9166 for WebFlux client and
server, but for the `WebTestClient` auto-configuration.
`WebTestClient` can be configured for mock or integration tests and this
change applies `CodecCustomizer` beans to the client being built.
Closes gh-9577
This commit adds ContextLoader, a test helper that configures an
ApplicationContext that is meant to simulate a particular
auto-configuration scenario.
The auto-configuration, user configuration and environment can be
customized. The loader invokes a ContextConsumer to assert the context
and automatically close the context once it is done.
Concretely, tests can create a shared field instance of that helper with
the shared configuration to increase its visibility and tune the context
further in each test.
If the context is expected to fail, `loadAndFail` allows to optionally
assert the root exception and consume it for further assertions.
This commit also migrates some tests to illustrate the practical use of
the helper
Closes gh-9634