You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/02/22 17:34:30 UTC
[GitHub] [flink] RyanSkraba commented on a change in pull request #18833: [FLINK-26228][dropwizard] Migrate tests to JUnit5
RyanSkraba commented on a change in pull request #18833:
URL: https://github.com/apache/flink/pull/18833#discussion_r812024396
##########
File path: flink-metrics/flink-metrics-dropwizard/src/test/java/org/apache/flink/dropwizard/ScheduledDropwizardReporterTest.java
##########
@@ -84,25 +83,25 @@ public void testAddingMetrics() {
reporter.notifyOfAddedMetric(meterWrapper, "meter", metricGroup);
Map<Counter, String> counters = reporter.getCounters();
- assertTrue(counters.containsKey(myCounter));
+ assertThat(counters).containsKey(myCounter);
Map<Meter, String> meters = reporter.getMeters();
- assertTrue(meters.containsKey(meterWrapper));
+ assertThat(meters).containsKey(meterWrapper);
String expectedCounterName =
reporter.filterCharacters(scope)
+ delimiter
+ reporter.filterCharacters(counterName);
- assertEquals(expectedCounterName, counters.get(myCounter));
+ assertThat(counters.get(myCounter)).isEqualTo(expectedCounterName);
Review comment:
```suggestion
assertThat(counters).containsEntry(myCounter, expectedCounterName);
```
##########
File path: flink-metrics/flink-metrics-dropwizard/src/test/java/org/apache/flink/dropwizard/metrics/DropwizardFlinkHistogramWrapperTest.java
##########
@@ -85,15 +86,15 @@ public void testDropwizardHistogramWrapperReporting() throws Exception {
String fullMetricName = metricGroup.getMetricIdentifier(histogramMetricName);
Snapshot snapshot = testingReporter.getNextHistogramSnapshot(fullMetricName);
- assertEquals(0, snapshot.getMin());
- assertEquals((size - 1) / 2.0, snapshot.getMedian(), 0.001);
- assertEquals(size - 1, snapshot.getMax());
- assertEquals(size, snapshot.size());
+ assertThat(snapshot.getMin()).isEqualTo(0);
+ assertThat(snapshot.getMedian()).isEqualTo((size - 1) / 2.0, offset(0.001));
Review comment:
```suggestion
assertThat(snapshot.getMedian()).isCloseTo((size - 1) / 2.0, offset(0.001));
```
This is _exactly_ the same and a bit nit-picky -- I find this adds to readability, but (again) I don't feel too strongly about it. There's a number of these throughout the code.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org