use of org.springframework.boot.actuate.endpoint.jmx.EndpointObjectNameFactory in project spring-boot by spring-projects.
the class JmxEndpointAutoConfigurationTests method jmxEndpointWithCustomEndpointObjectNameFactory.
@Test
void jmxEndpointWithCustomEndpointObjectNameFactory() {
EndpointObjectNameFactory factory = mock(EndpointObjectNameFactory.class);
this.contextRunner.withPropertyValues("spring.jmx.enabled=true").with(mockMBeanServer()).withBean(EndpointObjectNameFactory.class, () -> factory).run((context) -> {
ArgumentCaptor<ExposableJmxEndpoint> argumentCaptor = ArgumentCaptor.forClass(ExposableJmxEndpoint.class);
then(factory).should().getObjectName(argumentCaptor.capture());
ExposableJmxEndpoint jmxEndpoint = argumentCaptor.getValue();
assertThat(jmxEndpoint.getEndpointId().toLowerCaseString()).isEqualTo("test");
});
}
Aggregations