|
6 | 6 | package io.opentelemetry.sdk.autoconfigure; |
7 | 7 |
|
8 | 8 | import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; |
9 | | -import static java.util.Collections.singletonMap; |
10 | | -import static org.assertj.core.api.Assertions.assertThat; |
11 | | -import static org.assertj.core.api.Assertions.assertThatCode; |
12 | 9 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
13 | 10 | import static org.mockito.ArgumentMatchers.any; |
14 | 11 | import static org.mockito.Mockito.doReturn; |
@@ -96,21 +93,23 @@ void configFile_fileNotFound() { |
96 | 93 | assertThatThrownBy( |
97 | 94 | () -> |
98 | 95 | AutoConfiguredOpenTelemetrySdk.builder() |
99 | | - .addPropertiesSupplier(() -> singletonMap("otel.config.file", "foo")) |
100 | | - .addPropertiesSupplier( |
101 | | - () -> singletonMap("otel.experimental.config.file", "foo")) |
102 | | - .addPropertiesSupplier(() -> singletonMap("otel.sdk.disabled", "true")) |
| 96 | + .setConfig( |
| 97 | + DefaultConfigProperties.createFromMap( |
| 98 | + Collections.singletonMap("otel.experimental.config.file", "foo"))) |
103 | 99 | .build()) |
104 | 100 | .isInstanceOf(ConfigurationException.class) |
105 | 101 | .hasMessageContaining("Configuration file not found"); |
106 | 102 |
|
107 | | - assertThatCode( |
| 103 | + assertThatThrownBy( |
108 | 104 | () -> |
109 | 105 | AutoConfiguredOpenTelemetrySdk.builder() |
110 | | - .addPropertiesSupplier(() -> singletonMap("otel.experimental.config.file", "")) |
111 | | - .addPropertiesSupplier(() -> singletonMap("otel.sdk.disabled", "true")) |
| 106 | + .setConfig( |
| 107 | + DefaultConfigProperties.createFromMap( |
| 108 | + Collections.singletonMap("otel.experimental.config.file", ""))) |
112 | 109 | .build()) |
113 | | - .doesNotThrowAnyException(); |
| 110 | + .hasMessageContaining( |
| 111 | + "otel.metrics.exporter set to \"otlp\" but opentelemetry-exporter-otlp not found on " |
| 112 | + + "classpath. Make sure to add it as a dependency."); |
114 | 113 | } |
115 | 114 |
|
116 | 115 | @Test |
|
0 commit comments