wangzzu commented on code in PR #23265:
URL: https://github.com/apache/flink/pull/23265#discussion_r1306576699
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerLocationTest.java:
##########
@@ -26,7 +26,7 @@
import java.net.InetAddress;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.assertj.core.api.Assertions.fail;
Review Comment:
we use assertThatThrowsBy to replace `fail()`
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java:
##########
@@ -420,11 +408,11 @@ public void testFailWithWrappedException() throws
Exception {
task.run();
- assertEquals(ExecutionState.FAILED, task.getExecutionState());
- assertTrue(task.isCanceledOrFailed());
+ assertThat(task.getExecutionState()).isEqualTo(ExecutionState.FAILED);
+ assertThat(task.isCanceledOrFailed()).isTrue();
final Throwable cause = task.getFailureCause();
- assertTrue(cause instanceof IOException);
+ assertThat(cause instanceof IOException).isTrue();
Review Comment:
isIntanceOf
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java:
##########
@@ -540,9 +527,9 @@ public void testFailExternallyDuringInvoke() throws
Exception {
task.getExecutingThread().join();
- assertEquals(ExecutionState.FAILED, task.getExecutionState());
- assertTrue(task.isCanceledOrFailed());
- assertTrue(task.getFailureCause().getMessage().contains("test"));
+ assertThat(task.getExecutionState()).isEqualTo(ExecutionState.FAILED);
+ assertThat(task.isCanceledOrFailed()).isTrue();
+
assertThat(task.getFailureCause().getMessage().contains("test")).isTrue();
Review Comment:
we use `contains(XX)` interface directly, you can check it globally
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java:
##########
@@ -897,9 +884,9 @@ public void testTriggerPartitionStateUpdate() throws
Exception {
promise.complete(ExecutionState.RUNNING);
- assertEquals(ExecutionState.RUNNING, task.getExecutionState());
+
assertThat(task.getExecutionState()).isEqualTo(ExecutionState.RUNNING);
- assertEquals(1, callCount.get());
+ assertThat(callCount.get()).isEqualTo(1);
Review Comment:
isOne
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java:
##########
@@ -150,10 +147,11 @@ public void
testCancelAsyncProducerAndConsumer(@InjectMiniCluster MiniCluster fl
}
// Verify that async producer is in blocking request
- assertTrue(
- "Producer thread is not blocked: "
- +
Arrays.toString(ASYNC_PRODUCER_THREAD.getStackTrace()),
- producerBlocked);
+ assertThat(producerBlocked)
+ .withFailMessage(
Review Comment:
maybe use `as` too here, we can unify this
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java:
##########
@@ -854,9 +841,9 @@ public void testTriggerPartitionStateUpdate() throws
Exception {
promise.completeExceptionally(new TimeoutException());
- assertEquals(ExecutionState.RUNNING, task.getExecutionState());
+
assertThat(task.getExecutionState()).isEqualTo(ExecutionState.RUNNING);
- assertEquals(1, callCount.get());
+ assertThat(callCount.get()).isEqualTo(1);
Review Comment:
isOne
##########
flink-runtime/src/test/java/org/apache/flink/runtime/security/token/hadoop/HadoopFSDelegationTokenProviderITCase.java:
##########
@@ -129,32 +127,30 @@ protected void obtainDelegationTokens(
}
};
- assertEquals(
- Optional.of(1L),
- provider.getTokenRenewalInterval(constantClock,
Collections.emptySet()));
+ assertThat(provider.getTokenRenewalInterval(constantClock,
Collections.emptySet()))
+ .isEqualTo(Optional.of(1L));
Review Comment:
assertThat(provider.getTokenRenewalInterval(constantClock,
Collections.emptySet()).get())
.isOne();
--
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]