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