jinmeiliao commented on a change in pull request #7088: URL: https://github.com/apache/geode/pull/7088#discussion_r745021328
########## File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/OpExecutorImplUnitTest.java ########## @@ -94,9 +95,57 @@ public void authenticateIfRequired_setId_singleUser_hasNoId() { when(server.getUserId()).thenReturn(-1L); when(pool.executeOn(any(Connection.class), any(Op.class))).thenReturn(123L); when(connection.getWrappedConnection()).thenReturn(connection); - executor.authenticateIfRequired(connection, op); - verify(pool).executeOn(any(Connection.class), any(Op.class)); - verify(server).setUserId(eq(123L)); + executor.authenticateIfMultiUser(connection, op); + verify(pool, never()).executeOn(any(Connection.class), any(Op.class)); + } + + @Test + public void execute_calls_authenticateIfMultiUser() throws Exception { + when(connection.execute(any())).thenReturn(123L); + when(connectionManager.borrowConnection(5)).thenReturn(connection); + OpExecutorImpl spy = spy(executor); + + spy.execute(op, 1); + verify(spy).authenticateIfMultiUser(any(), any()); } + @Test + public void authenticateIfMultiUser_calls_authenticateMultiUser() { Review comment: I was always torn between both ways: split into multiple tests or put them in one and have less code. If test fails, which line it fails definitely tells you what exactly the problem is. This way, it seems very concise and provide a stream line of the stepping further down the code. -- 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...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org