优化
This commit is contained in:
+20
@@ -8,12 +8,32 @@ import org.junit.jupiter.api.Test;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
class EventBridgeMetricsTest {
|
||||
|
||||
@Test
|
||||
void productionConstructorIsExplicitForSpringWhenTestClockConstructorAlsoExists() throws Exception {
|
||||
assertThat(EventBridgeMetrics.class.getConstructor(MeterRegistry.class)
|
||||
.isAnnotationPresent(Autowired.class)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void springContextCreatesMetricsBeanWithTheAnnotatedProductionConstructor() {
|
||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
|
||||
context.registerBean(MeterRegistry.class, SimpleMeterRegistry::new);
|
||||
context.register(EventBridgeMetrics.class);
|
||||
context.refresh();
|
||||
|
||||
assertThat(context.getBean(EventBridgeMetrics.class)).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void collapsesUnboundedRegionAndEventTypeLabelsToOther() {
|
||||
SimpleMeterRegistry registry = new SimpleMeterRegistry();
|
||||
|
||||
Reference in New Issue
Block a user