zentol commented on code in PR #18983:
URL: https://github.com/apache/flink/pull/18983#discussion_r866649936


##########
flink-yarn/src/test/java/org/apache/flink/yarn/TaskExecutorProcessSpecContainerResourcePriorityAdapterTest.java:
##########
@@ -206,40 +199,49 @@ public void testExternalResource() {
 
         final Map<String, Long> resultExternalResources =
                 
ResourceInformationReflector.INSTANCE.getExternalResources(resource);
-        assertThat(resultExternalResources.size(), is(1));
-        assertThat(
-                
resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY),
-                is(SUPPORTED_EXTERNAL_RESOURCE_MAX));
+        assertThat(resultExternalResources).hasSize(1);
+        
assertThat(resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY))
+                .isEqualTo(SUPPORTED_EXTERNAL_RESOURCE_MAX);
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void testExternalResourceFailExceedMax() {
+    @Test
+    void testExternalResourceFailExceedMax() {
         assumeTrue(isExternalResourceSupported());
-
-        getAdapterWithExternalResources(
-                        SUPPORTED_EXTERNAL_RESOURCE_NAME, 
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
-                .getPriorityAndResource(
-                        
TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX);
+        assertThatThrownBy(
+                        () ->
+                                getAdapterWithExternalResources(
+                                                
SUPPORTED_EXTERNAL_RESOURCE_NAME,
+                                                
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)

Review Comment:
   I'm suggesting to remove as many statements as possible out of the 
"assertThatThrownBy" block. The goal is making sure that the right call is 
throwing the exception that we check for.



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