RyanSkraba commented on a change in pull request #18821:
URL: https://github.com/apache/flink/pull/18821#discussion_r809285780



##########
File path: 
flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
##########
@@ -82,17 +77,17 @@ public void testAddCounter() throws Exception {
                         + ": 0";
 
         reporter.report();
-        assertThat(
-                testLoggerResource.getMessages(), 
hasItem(containsString(expectedCounterReport)));
+        assertThat(testLoggerResource.getMessages())
+                .anyMatch(logOutput -> 
logOutput.contains(expectedCounterReport));
     }
 
     @Test
-    public void testAddGauge() throws Exception {
+    void testAddGauge() throws Exception {
         String gaugeName = "gauge";
 
         Gauge<Long> gauge = () -> null;
         reporter.notifyOfAddedMetric(gauge, gaugeName, metricGroup);
-        assertTrue(reporter.getGauges().containsKey(gauge));
+        assertThat(reporter.getGauges().containsKey(gauge));

Review comment:
       ```suggestion
           assertThat(reporter.getGauges()).containsKey(gauge);
   ```
   Misplaced parenthesis causes this test to be ignored.

##########
File path: 
flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
##########
@@ -101,16 +96,17 @@ public void testAddGauge() throws Exception {
                         + ": null";
 
         reporter.report();
-        assertThat(testLoggerResource.getMessages(), 
hasItem(containsString(expectedGaugeReport)));
+        assertThat(testLoggerResource.getMessages())
+                .anyMatch(logOutput -> 
logOutput.contains(expectedGaugeReport));
     }
 
     @Test
-    public void testAddMeter() throws Exception {
+    void testAddMeter() throws Exception {
         String meterName = "meter";
 
         Meter meter = new MeterView(5);
         reporter.notifyOfAddedMetric(meter, meterName, metricGroup);
-        assertTrue(reporter.getMeters().containsKey(meter));
+        assertThat(reporter.getMeters().containsKey(meter));

Review comment:
       ```suggestion
           assertThat(reporter.getMeters()).containsKey(meter);
   ```

##########
File path: 
flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
##########
@@ -119,31 +115,32 @@ public void testAddMeter() throws Exception {
                         + ": 0.0";
 
         reporter.report();
-        assertThat(testLoggerResource.getMessages(), 
hasItem(containsString(expectedMeterReport)));
+        assertThat(testLoggerResource.getMessages())
+                .anyMatch(logOutput -> 
logOutput.contains(expectedMeterReport));
     }
 
     @Test
-    public void testAddHistogram() throws Exception {
+    void testAddHistogram() throws Exception {
         String histogramName = "histogram";
 
         Histogram histogram = new TestHistogram();
         reporter.notifyOfAddedMetric(histogram, histogramName, metricGroup);
-        assertTrue(reporter.getHistograms().containsKey(histogram));
+        assertThat(reporter.getHistograms().containsKey(histogram));

Review comment:
       ```suggestion
           assertThat(reporter.getHistograms()).containsKey(histogram);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to