RyanSkraba commented on a change in pull request #18835:
URL: https://github.com/apache/flink/pull/18835#discussion_r813087468
##########
File path:
flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/MeterViewTest.java
##########
@@ -59,49 +58,49 @@ public void testGetRate() {
m.update();
}
// values = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]
- assertEquals(2.0, m.getRate(), 0.1); // 120 - 0 / 60
+ assertThat(m.getRate()).isEqualTo(2.0, offset(0.1)); // 120 - 0 / 60
for (int x = 0; x < 12; x++) {
m.markEvent(10);
m.update();
}
// values = [130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230,
240, 120]
- assertEquals(2.0, m.getRate(), 0.1); // 240 - 120 / 60
+ assertThat(m.getRate()).isEqualTo(2.0, offset(0.1)); // 240 - 120 / 60
for (int x = 0; x < 6; x++) {
m.markEvent(20);
m.update();
}
// values = [280, 300, 320, 340, 360, 180, 190, 200, 210, 220, 230,
240, 260]
- assertEquals(3.0, m.getRate(), 0.1); // 360 - 180 / 60
+ assertThat(m.getRate()).isEqualTo(3.0, offset(0.1)); // 360 - 180 / 60
for (int x = 0; x < 6; x++) {
m.markEvent(20);
m.update();
}
// values = [280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480,
240, 260]
- assertEquals(4.0, m.getRate(), 0.1); // 480 - 240 / 60
+ assertThat(m.getRate()).isEqualTo(4.0, offset(0.1)); // 480 - 240 / 60
for (int x = 0; x < 6; x++) {
m.update();
}
// values = [480, 480, 480, 480, 360, 380, 400, 420, 440, 460, 480,
480, 480]
- assertEquals(2.0, m.getRate(), 0.1); // 480 - 360 / 60
+ assertThat(m.getRate()).isEqualTo(2.0, offset(0.1)); // 480 - 360 / 60
for (int x = 0; x < 6; x++) {
m.update();
}
// values = [480, 480, 480, 480, 480, 480, 480, 480, 480, 480, 480,
480, 480]
- assertEquals(0.0, m.getRate(), 0.1); // 480 - 480 / 60
+ assertThat(m.getRate()).isEqualTo(0.0, offset(0.1)); // 480 - 480 / 60
}
@Test
- public void testTimeSpanBelowUpdateRate() {
+ void testTimeSpanBelowUpdateRate() {
int timeSpanInSeconds = 1;
MeterView m = new MeterView(timeSpanInSeconds);
assert timeSpanInSeconds < UPDATE_INTERVAL_SECONDS;
Review comment:
Just to verify -- this is intentionally a Java `assert`? I guess I
understand the reason (it validates the purpose of this test as opposed to
expected/actual data), but I'm tempted to think we should just standardize on
AssertJ for everything.
##########
File path:
flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/AbstractHistogramTest.java
##########
@@ -18,15 +18,13 @@
package org.apache.flink.metrics;
-import org.apache.flink.util.TestLogger;
-
import static org.junit.Assert.assertEquals;
Review comment:
Looks like these assertions were missed and can be converted to AssertJ
--
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]