@@ -51,7 +51,7 @@ class EmfMetricsLoggerTest {
51
51
52
52
private Metrics metrics ;
53
53
private final ObjectMapper objectMapper = new ObjectMapper ();
54
- private final PrintStream standardOut = System .out ;
54
+ private static final PrintStream standardOut = System .out ;
55
55
private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream ();
56
56
57
57
@ BeforeEach
@@ -180,7 +180,7 @@ void shouldAddDimension() throws Exception {
180
180
JsonNode dimensions = rootNode .get ("_aws" ).get ("CloudWatchMetrics" ).get (0 ).get ("Dimensions" ).get (0 );
181
181
boolean hasDimension = false ;
182
182
for (JsonNode dimension : dimensions ) {
183
- if (dimension .asText (). equals ( "CustomDimension" )) {
183
+ if ("CustomDimension" . equals ( dimension .asText ())) {
184
184
hasDimension = true ;
185
185
break ;
186
186
}
@@ -233,9 +233,9 @@ void shouldAddDimensionSet() throws Exception {
233
233
boolean hasDim2 = false ;
234
234
for (JsonNode dimension : dimensions ) {
235
235
String dimName = dimension .asText ();
236
- if (dimName . equals ( "Dim1" )) {
236
+ if ("Dim1" . equals ( dimName )) {
237
237
hasDim1 = true ;
238
- } else if (dimName . equals ( "Dim2" )) {
238
+ } else if ("Dim2" . equals ( dimName )) {
239
239
hasDim2 = true ;
240
240
}
241
241
}
@@ -348,6 +348,8 @@ void shouldLogWarningOnEmptyMetrics() throws Exception {
348
348
// Read the log file and check for the warning
349
349
String logContent = new String (Files .readAllBytes (logFile .toPath ()), StandardCharsets .UTF_8 );
350
350
assertThat (logContent ).contains ("No metrics were emitted" );
351
+ // No EMF output should be generated
352
+ assertThat (outputStreamCaptor .toString ().trim ()).isEmpty ();
351
353
}
352
354
353
355
@ Test
0 commit comments