Merge branch '6.0.x'

# Conflicts:
#	spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
This commit is contained in:
Sam Brannen
2023-06-25 15:34:10 +02:00
3 changed files with 25 additions and 22 deletions

View File

@@ -166,9 +166,9 @@ public class ClassPathXmlApplicationContextTests {
void contextWithInvalidLazyClass() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(INVALID_CLASS_CONTEXT, getClass());
assertThat(ctx.containsBean("someMessageSource")).isTrue();
assertThatExceptionOfType(CannotLoadBeanClassException.class).isThrownBy(() ->
ctx.getBean("someMessageSource"))
.satisfies(ex -> assertThat(ex.contains(ClassNotFoundException.class)).isTrue());
assertThatExceptionOfType(CannotLoadBeanClassException.class)
.isThrownBy(() -> ctx.getBean("someMessageSource"))
.withCauseExactlyInstanceOf(ClassNotFoundException.class);
ctx.close();
}
@@ -176,8 +176,7 @@ public class ClassPathXmlApplicationContextTests {
void contextWithClassNameThatContainsPlaceholder() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(CLASS_WITH_PLACEHOLDER_CONTEXT, getClass());
assertThat(ctx.containsBean("someMessageSource")).isTrue();
boolean condition = ctx.getBean("someMessageSource") instanceof StaticMessageSource;
assertThat(condition).isTrue();
assertThat(ctx.getBean("someMessageSource")).isInstanceOf(StaticMessageSource.class);
ctx.close();
}

View File

@@ -84,8 +84,8 @@ public class MBeanExporterTests extends AbstractMBeanServerTests {
listeners.put("*", null);
MBeanExporter exporter = new MBeanExporter();
assertThatIllegalArgumentException().isThrownBy(() ->
exporter.setNotificationListenerMappings(listeners));
assertThatIllegalArgumentException()
.isThrownBy(() -> exporter.setNotificationListenerMappings(listeners));
}
@Test
@@ -100,9 +100,10 @@ public class MBeanExporterTests extends AbstractMBeanServerTests {
exporter.setBeans(getBeanMap());
exporter.setServer(server);
exporter.setNotificationListenerMappings(listeners);
assertThatExceptionOfType(MBeanExportException.class).as("NotificationListener on a non-existent MBean").isThrownBy(() ->
start(exporter))
.satisfies(ex -> assertThat(ex.contains(InstanceNotFoundException.class)).isTrue());
assertThatExceptionOfType(MBeanExportException.class)
.as("NotificationListener on a non-existent MBean")
.isThrownBy(() -> start(exporter))
.withCauseExactlyInstanceOf(InstanceNotFoundException.class);
}
@Test
@@ -165,8 +166,8 @@ public class MBeanExporterTests extends AbstractMBeanServerTests {
ObjectInstance instance = server.getObjectInstance(ObjectNameManager.getInstance("spring:mbean=true"));
assertThat(instance).isNotNull();
assertThatExceptionOfType(InstanceNotFoundException.class).isThrownBy(() ->
server.getObjectInstance(ObjectNameManager.getInstance("spring:mbean=false")));
assertThatExceptionOfType(InstanceNotFoundException.class)
.isThrownBy(() -> server.getObjectInstance(ObjectNameManager.getInstance("spring:mbean=false")));
}
}