betterjava edited a comment on issue #2127: #2126 add SQLLoggerTest
URL: 
https://github.com/apache/incubator-shardingsphere/pull/2127#issuecomment-477932991
 
 
   @terrymanu PowerMock can do this work.
   ```
           Logger log = PowerMockito.mock(Logger.class);
           PowerMockito.mockStatic(LoggerFactory.class);
           
PowerMockito.when(LoggerFactory.getLogger("ShardingSphere-SQL")).thenReturn(log);
           SQLLogger.logSQL("select * from user", Arrays.asList("db1", "db2"));
           InOrder inOrder = Mockito.inOrder(log);
           inOrder.verify(log).info("Rule Type: master-slave", new Object[]{});
           inOrder.verify(log).info("SQL: {} ::: DataSources: {}", new 
Object[]{ "select * from user","db1,db2"});
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to