コード例 #1
0
 @Test
 public void skipsFilterIfMissingServices() throws Exception {
   AnnotationConfigApplicationContext context =
       new AnnotationConfigApplicationContext(MetricFilterAutoConfiguration.class);
   assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0);
   context.close();
 }
コード例 #2
0
 @Test
 public void skipsFilterIfPropertyDisabled() throws Exception {
   AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
   EnvironmentTestUtils.addEnvironment(context, "endpoints.metrics.filter.enabled:false");
   context.register(Config.class, MetricFilterAutoConfiguration.class);
   context.refresh();
   assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0);
   context.close();
 }
 @Test
 public void testWithoutSettingAnyConfigProperties() {
   context.register(CloudWatchMetricAutoConfiguration.class);
   context.refresh();
   assertTrue(context.getBeansOfType(CloudWatchMetricWriter.class).isEmpty());
 }