AnonHxy commented on code in PR #17084:
URL: https://github.com/apache/pulsar/pull/17084#discussion_r947463138
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2153,4 +2167,157 @@ public void
testHandleAuthResponseWithoutClientVersion() {
verify(authResponse, times(1)).hasClientVersion();
verify(authResponse, times(0)).getClientVersion();
}
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ void shouldFailHandleLookup() throws Exception {
+ resetChannel();
+ Field stateUpdater = ServerCnx.class.getDeclaredField("state");
+ stateUpdater.setAccessible(true);
+ stateUpdater.set(serverCnx, ServerCnx.State.Failed);
+
+ CommandLookupTopic commandLookupTopic = spy(CommandLookupTopic.class);
+ serverCnx.handleLookup(commandLookupTopic);
Review Comment:
Maybe `serverCnx.handleLookup(any(CommandLookupTopic.class))` is better :)
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2153,4 +2167,157 @@ public void
testHandleAuthResponseWithoutClientVersion() {
verify(authResponse, times(1)).hasClientVersion();
verify(authResponse, times(0)).getClientVersion();
}
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ void shouldFailHandleLookup() throws Exception {
+ resetChannel();
+ Field stateUpdater = ServerCnx.class.getDeclaredField("state");
+ stateUpdater.setAccessible(true);
+ stateUpdater.set(serverCnx, ServerCnx.State.Failed);
Review Comment:
This modification will change `serverCnx` state, which is a common
component in the test class. I think it is better to use mock a `ServerCnx` here
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java:
##########
@@ -2153,4 +2167,157 @@ public void
testHandleAuthResponseWithoutClientVersion() {
verify(authResponse, times(1)).hasClientVersion();
verify(authResponse, times(0)).getClientVersion();
}
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ void shouldFailHandleLookup() throws Exception {
+ resetChannel();
Review Comment:
I think the test method should be public
--
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]