rpuch commented on a change in pull request #647:
URL: https://github.com/apache/ignite-3/pull/647#discussion_r803367968



##########
File path: 
modules/cli/src/test/java/org/apache/ignite/cli/IgniteCliInterfaceTest.java
##########
@@ -581,17 +619,200 @@ void setJson() throws IOException, InterruptedException {
                             + "local.baseline.autoAdjust.enabled=true --type 
node"
                     ).split(" "));
 
-            Assertions.assertEquals(0, exitCode);
-            verify(httpClient).send(
-                    argThat(r -> 
"http://localhost:8081/management/v1/configuration/node/".equals(r.uri().toString())
-                            && "PATCH".equals(r.method())
-                            && r.bodyPublisher().get().contentLength() == 
expSentContent.getBytes(UTF_8).length
-                            && 
"application/json".equals(r.headers().firstValue("Content-Type").get())),
-                    any());
-            assertEquals("Configuration was updated successfully.\n\n"
+            assertThatExitCodeMeansSuccess(exitCode);
+
+            verify(httpClient).send(requestCaptor.capture(), any());
+            HttpRequest capturedRequest = requestCaptor.getValue();
+
+            assertThat(capturedRequest.uri().toString(), 
is("http://localhost:8081/management/v1/configuration/node/";));
+            assertThat(capturedRequest.method(), is("PATCH"));
+            assertThat(requestBodyBytes(capturedRequest), 
is(expSentContent.getBytes(UTF_8)));
+            assertThat(capturedRequest.headers().firstValue("Content-Type"), 
isPresentAnd(is("application/json")));
+
+            assertOutputEqual("Configuration was updated successfully.\n\n"
                     + "Use the " + cmd.getColorScheme().commandText("ignite 
config get")
-                    + " command to view the updated configuration.\n", 
out.toString());
+                    + " command to view the updated configuration.\n", 
out.toString(UTF_8));
+            assertThatStderrIsEmpty();
+        }
+    }
+
+    /**
+     * Tests "cluster" command.
+     */
+    @Nested
+    @DisplayName("cluster")
+    class Cluster {

Review comment:
       It uses some infrastructure defined in the containing class, that would 
probably require to transform all the internal test classes defined here for 
consistency. Probably a separaate JIRA issue for refactoring tests seems a good 
option, WDYT?

##########
File path: 
modules/cli/src/test/java/org/apache/ignite/cli/IgniteCliInterfaceTest.java
##########
@@ -581,17 +619,200 @@ void setJson() throws IOException, InterruptedException {
                             + "local.baseline.autoAdjust.enabled=true --type 
node"
                     ).split(" "));
 
-            Assertions.assertEquals(0, exitCode);
-            verify(httpClient).send(
-                    argThat(r -> 
"http://localhost:8081/management/v1/configuration/node/".equals(r.uri().toString())
-                            && "PATCH".equals(r.method())
-                            && r.bodyPublisher().get().contentLength() == 
expSentContent.getBytes(UTF_8).length
-                            && 
"application/json".equals(r.headers().firstValue("Content-Type").get())),
-                    any());
-            assertEquals("Configuration was updated successfully.\n\n"
+            assertThatExitCodeMeansSuccess(exitCode);
+
+            verify(httpClient).send(requestCaptor.capture(), any());
+            HttpRequest capturedRequest = requestCaptor.getValue();
+
+            assertThat(capturedRequest.uri().toString(), 
is("http://localhost:8081/management/v1/configuration/node/";));
+            assertThat(capturedRequest.method(), is("PATCH"));
+            assertThat(requestBodyBytes(capturedRequest), 
is(expSentContent.getBytes(UTF_8)));
+            assertThat(capturedRequest.headers().firstValue("Content-Type"), 
isPresentAnd(is("application/json")));
+
+            assertOutputEqual("Configuration was updated successfully.\n\n"
                     + "Use the " + cmd.getColorScheme().commandText("ignite 
config get")
-                    + " command to view the updated configuration.\n", 
out.toString());
+                    + " command to view the updated configuration.\n", 
out.toString(UTF_8));
+            assertThatStderrIsEmpty();
+        }
+    }
+
+    /**
+     * Tests "cluster" command.
+     */
+    @Nested
+    @DisplayName("cluster")
+    class Cluster {

Review comment:
       It uses some infrastructure defined in the containing class, that would 
probably require to transform all the internal test classes defined here for 
consistency. Probably a separaate JIRA issue for refactoring tests seems to be 
a good option, WDYT?




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