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
Previously, if a user's configuration class provided a custom
Validator bean, that configuration class would be initialized very
early so that the Validator could be used to create the
auto-configured MethodValidationPostProcessor. This early
initialization could problems as it may prevent any of the
configuration class's dependencies from being post-processed.
This commit updates the injection of the Validator bean to be lazy,
thereby preventing the creation of the auto-configured
MethodValidationPostProcessor from triggering early initialization.
Closes gh-9416
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
Add a general purpose `Configurations` class that encapsulates the
sorting and merging rules that are usually apply. The class is
particularly useful in tests where configuration classes often need
to be specified, but an `@Import` or `ImportSelector` cannot be easily
used.
Two `Configurations` subclasses have been initially added. The
`UserConfigurations` class can be used to represent user defined
configuration and the `AutoConfigurations` class can be used to
represent a subset of auto-configurations. Auto configurations are
sorted using the same `@AutoConfiguraionBefore`/`@AutoConfiguraionAfter`
logic as the `@EnableAutoConfiguration` annotation.
Fixes gh-9795
Split the current `ReactiveWebApplicationContext` into two distinct
interfaces to mirror other Spring context interfaces. The
`ReactiveWebApplicationContext` interface now only exposes getters. The
`ConfigurableReactiveWebApplicationContext` exposes setters and extends
from `ConfigurableApplicationContext`.
Fixes gh-9794
PR #7672 Added support for arbitrary common properties.
However, Kafka emits a warning if a producer configuration contains
properties intended only for consumers, and vice versa.
The documentation showed a sample of how to write code to configure
arbitrary properties but this is inconvenient.
Add arbitrary properties to the consumer and procucer configs.
See gh-9775