yanrongzhen commented on code in PR #4480:
URL: https://github.com/apache/eventmesh/pull/4480#discussion_r1352265096


##########
eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/SubClientImpl.java:
##########
@@ -171,35 +167,31 @@ public Package dispatcher(Package request, long timeout) 
throws Exception {
         Package response = super.io(request, timeout);
         switch (request.getHeader().getCommand()) {
             case HELLO_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.HELLO_RESPONSE);
+                Assertions.assertEquals(Command.HELLO_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case HEARTBEAT_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.HEARTBEAT_RESPONSE);
+                Assertions.assertEquals(Command.HEARTBEAT_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case LISTEN_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.LISTEN_RESPONSE);
+                Assertions.assertEquals(Command.LISTEN_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case CLIENT_GOODBYE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.CLIENT_GOODBYE_RESPONSE);
+                Assertions.assertEquals(Command.CLIENT_GOODBYE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case SUBSCRIBE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.SUBSCRIBE_RESPONSE);
+                Assertions.assertEquals(Command.SUBSCRIBE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case UNSUBSCRIBE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.UNSUBSCRIBE_RESPONSE);
+                Assertions.assertEquals(Command.UNSUBSCRIBE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case SYS_LOG_TO_LOGSERVER:
-                Assertions.assertNull(response);
-                break;
             case TRACE_LOG_TO_LOGSERVER:
                 Assertions.assertNull(response);
                 break;
             default:
                 break;
         }
-        if (response != null) {
-            assert response.getHeader().getCode() == 
OPStatus.SUCCESS.getCode();
-        }
+        assert response == null || response.getHeader().getCode() == 
OPStatus.SUCCESS.getCode();

Review Comment:
   The judgment logic has been optimized, `| |` has been replaced with `&&` to 
improve readability.



##########
eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/SubClientImpl.java:
##########
@@ -171,35 +167,31 @@ public Package dispatcher(Package request, long timeout) 
throws Exception {
         Package response = super.io(request, timeout);
         switch (request.getHeader().getCommand()) {
             case HELLO_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.HELLO_RESPONSE);
+                Assertions.assertEquals(Command.HELLO_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case HEARTBEAT_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.HEARTBEAT_RESPONSE);
+                Assertions.assertEquals(Command.HEARTBEAT_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case LISTEN_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.LISTEN_RESPONSE);
+                Assertions.assertEquals(Command.LISTEN_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case CLIENT_GOODBYE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.CLIENT_GOODBYE_RESPONSE);
+                Assertions.assertEquals(Command.CLIENT_GOODBYE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case SUBSCRIBE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.SUBSCRIBE_RESPONSE);
+                Assertions.assertEquals(Command.SUBSCRIBE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case UNSUBSCRIBE_REQUEST:
-                Assertions.assertEquals(response.getHeader().getCommand(), 
Command.UNSUBSCRIBE_RESPONSE);
+                Assertions.assertEquals(Command.UNSUBSCRIBE_RESPONSE, 
response.getHeader().getCommand());
                 break;
             case SYS_LOG_TO_LOGSERVER:
-                Assertions.assertNull(response);
-                break;
             case TRACE_LOG_TO_LOGSERVER:
                 Assertions.assertNull(response);
                 break;
             default:
                 break;
         }
-        if (response != null) {
-            assert response.getHeader().getCode() == 
OPStatus.SUCCESS.getCode();
-        }
+        assert response == null || response.getHeader().getCode() == 
OPStatus.SUCCESS.getCode();

Review Comment:
   The judgment logic has been optimized, `||` has been replaced with `&&` to 
improve readability.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to