XComp commented on code in PR #23203:
URL: https://github.com/apache/flink/pull/23203#discussion_r1294717113


##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/StateTest.java:
##########
@@ -18,85 +18,71 @@
 
 package org.apache.flink.runtime.scheduler.adaptive;
 
-import org.apache.flink.util.TestLogger;
-
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
 
 /**
  * Tests for the default methods on the {@link State} interface, based on the 
{@link Created} state,
  * as it is a simple state.
  */
-public class StateTest extends TestLogger {
+class StateTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(StateTest.class);
+
+    @RegisterExtension CreatedTest.MockCreatedContext ctx = new 
CreatedTest.MockCreatedContext();

Review Comment:
   We might want to move the `AfterEachCallback` refactoring into a separate 
hotfix commit (and do the FLINK-32859-related changes afterwards.



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/StateWithoutExecutionGraphTest.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.scheduler.adaptive;
+
+import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.runtime.failure.FailureEnricherUtils;
+import org.apache.flink.util.FlinkException;
+
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for the {@link StateWithoutExecutionGraph} state. */
+public class StateWithoutExecutionGraphTest {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreatedTest.class);
+
+    @Test
+    void testCancelTransitionsToFinished() {
+        MockStateWithoutExecutionGraphContext ctx = new 
MockStateWithoutExecutionGraphContext();

Review Comment:
   Interestingly, here you didn't utilize the extension in the proper way using 
a field :smile: can you change that?



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/CreatedTest.java:
##########
@@ -18,120 +18,60 @@
 
 package org.apache.flink.runtime.scheduler.adaptive;
 
-import org.apache.flink.api.common.JobID;
 import org.apache.flink.api.common.JobStatus;
 import org.apache.flink.runtime.executiongraph.ArchivedExecutionGraph;
 import org.apache.flink.runtime.executiongraph.ExecutionGraph;
-import org.apache.flink.runtime.failure.FailureEnricherUtils;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
 
-import java.util.function.Consumer;
-
-import static 
org.apache.flink.runtime.scheduler.adaptive.WaitingForResourcesTest.assertNonNull;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link Created} state. */
-public class CreatedTest extends TestLogger {
+class CreatedTest {
 
-    @Test
-    public void testCancel() throws Exception {
-        try (MockCreatedContext ctx = new MockCreatedContext()) {
-            Created created = new Created(ctx, log);
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreatedTest.class);
 
-            ctx.setExpectFinished(assertNonNull());
-
-            created.cancel();
-        }
-    }
+    @RegisterExtension MockCreatedContext ctx = new MockCreatedContext();

Review Comment:
   Nice :-)



-- 
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