Harmonize NoUniqueBeanDefinitionException message

This commit makes sure that the programmatic exception that is thrown
by the cache abstraction uses the same message structure as a default
message produced by NoUniqueBeanDefinitionException.

Closes gh-33305
This commit is contained in:
Stéphane Nicoll
2024-08-02 16:24:43 +02:00
parent 29dce74fcd
commit 0a2611b22f
4 changed files with 40 additions and 14 deletions

View File

@@ -95,7 +95,9 @@ class AspectJEnableCachingIsolatedTests {
}
catch (NoUniqueBeanDefinitionException ex) {
assertThat(ex.getMessage()).contains(
"no CacheResolver specified and expected a single CacheManager bean, but found 2: [cm1,cm2]");
"no CacheResolver specified and expected single matching CacheManager but found 2: cm1,cm2");
assertThat(ex.getNumberOfBeansFound()).isEqualTo(2);
assertThat(ex.getBeanNamesFound()).containsExactly("cm1", "cm2");
}
}