YongGoose commented on code in PR #7315:
URL: https://github.com/apache/incubator-seata/pull/7315#discussion_r2061157348


##########
core/src/test/java/org/apache/seata/core/rpc/processor/client/RmBranchCommitProcessorTest.java:
##########
@@ -134,31 +139,46 @@ void processShouldLogErrorWhenSendFails() throws 
Exception {
 
         processor.process(mockCtx, mockRpcMessage);
 
-        verify(mockLogger).error(eq("branch commit error: {}"), eq("Network 
failure"), eq(simulatedError));
+        assertTrue(getLogs(Level.ERROR).stream().anyMatch(log -> 
log.contains("branch commit error:")));
     }
 
     /**
-     * Process should not log debug when disabled.
+     * Process print log info when level is info.
      *
      * @throws Exception the exception
      */
     @Test
-    void processShouldNotLogDebugWhenDisabled() throws Exception {
+    void processShouldPrintLogInfoWhenLevelIsInfo() throws Exception {
         InetSocketAddress mockAddress = new InetSocketAddress("127.0.0.1", 
8091);
         Channel mockChannel = mock(Channel.class);
         when(mockCtx.channel()).thenReturn(mockChannel);
         when(mockChannel.remoteAddress()).thenReturn(mockAddress);
-        mockedNetUtil.when(() -> 
NetUtil.toStringAddress(any(SocketAddress.class))).thenReturn("127.0.0.1:8091");
+        mockedNetUtil
+                .when(() -> NetUtil.toStringAddress(any(SocketAddress.class)))
+                .thenReturn("127.0.0.1:8091");
 
         BranchCommitRequest mockRequest = mock(BranchCommitRequest.class);
         BranchCommitResponse mockResponse = mock(BranchCommitResponse.class);
         when(mockRpcMessage.getBody()).thenReturn(mockRequest);
         when(mockHandler.onRequest(mockRequest, 
null)).thenReturn(mockResponse);
-        when(mockLogger.isInfoEnabled()).thenReturn(true);
-        when(mockLogger.isDebugEnabled()).thenReturn(false);
-
         processor.process(mockCtx, mockRpcMessage);
 
-        verify(mockLogger, never()).debug(anyString(), (Object[])any());
+        assertTrue(
+                getLogs(Level.INFO).stream().anyMatch(log -> log.contains("rm 
client handle branch commit process:"))

Review Comment:
   Done in 
https://github.com/apache/incubator-seata/pull/7315/commits/cf6209739982d7755d31a27030e91271ea7c9045
 !



-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to