|
6 | 6 |
|
7 | 7 | import com.fasterxml.jackson.core.JsonProcessingException; |
8 | 8 | import com.fasterxml.jackson.databind.ObjectMapper; |
9 | | -import org.assertj.core.api.Assertions; |
10 | 9 | import org.junit.jupiter.api.AfterEach; |
11 | 10 | import org.junit.jupiter.api.BeforeAll; |
12 | 11 | import org.junit.jupiter.api.BeforeEach; |
|
16 | 15 | import software.amazon.cloudwatchlogs.emf.model.DimensionSet; |
17 | 16 | import software.amazon.cloudwatchlogs.emf.model.Unit; |
18 | 17 |
|
19 | | -import static java.util.Collections.*; |
20 | | -import static org.assertj.core.api.Assertions.*; |
| 18 | +import static java.util.Collections.emptyMap; |
21 | 19 | import static org.assertj.core.api.Assertions.assertThat; |
| 20 | +import static org.assertj.core.api.Assertions.assertThatNullPointerException; |
22 | 21 | import static org.mockito.Mockito.mockStatic; |
23 | 22 | import static software.amazon.lambda.powertools.core.internal.SystemWrapper.getenv; |
24 | 23 |
|
@@ -124,14 +123,14 @@ void singleMetricsCaptureUtilityWithDefaultNameSpace() { |
124 | 123 | } |
125 | 124 |
|
126 | 125 | @Test |
127 | | - void metricsCaptureUtilityWithDefaultNameSpace() { |
| 126 | + void metricsLoggerCaptureUtilityWithDefaultNameSpace() { |
128 | 127 | try (MockedStatic<SystemWrapper> mocked = mockStatic(SystemWrapper.class); |
129 | 128 | MockedStatic<software.amazon.lambda.powertools.core.internal.SystemWrapper> internalWrapper = mockStatic(software.amazon.lambda.powertools.core.internal.SystemWrapper.class)) { |
130 | 129 | mocked.when(() -> SystemWrapper.getenv("AWS_EMF_ENVIRONMENT")).thenReturn("Lambda"); |
131 | 130 | mocked.when(() -> SystemWrapper.getenv("POWERTOOLS_METRICS_NAMESPACE")).thenReturn("GlobalName"); |
132 | 131 | internalWrapper.when(() -> getenv("_X_AMZN_TRACE_ID")).thenReturn("Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1\""); |
133 | 132 |
|
134 | | - MetricsUtils.withMetric(metricsLogger -> { |
| 133 | + MetricsUtils.withMetricLogger(metricsLogger -> { |
135 | 134 | metricsLogger.setDimensions(DimensionSet.of("Dimension1", "Value1")); |
136 | 135 | metricsLogger.putMetric("Metric1", 1, Unit.COUNT); |
137 | 136 | }); |
|
0 commit comments