BewareMyPower commented on a change in pull request #13573:
URL: https://github.com/apache/pulsar/pull/13573#discussion_r778211725
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -1148,4 +1149,21 @@ public void testAdminTerminatePartitionedTopic() throws
Exception{
Assert.assertEquals(e.getMessage(), "Termination of a
non-partitioned topic is not allowed using partitioned-terminate, please use
terminate commands.");
}
}
+
+ /**
+ * Fix issue 13573
+ */
+ @Test
+ public void testTopicReferenceNPEReturn404(){
+ String topicName = "notFoundTopic";
+ String exceptionDetail = "testTopicReferenceNPEReturn404";
+ doThrow(new
RuntimeException(exceptionDetail)).when(pulsar).getBrokerService();
+ try{
+ persistentTopics.getTopicReference(TopicName.get(topicName));
+ }catch (Exception ex){
+ Assert.assertTrue(ex instanceof RestException);
+ Assert.assertTrue(((String)((RestException)
ex).getResponse().getEntity()).contains(exceptionDetail));
+ }
Review comment:
```suggestion
try {
persistentTopics.getTopicReference(TopicName.get(topicName));
} catch (Exception ex) {
Assert.assertTrue(ex instanceof RestException);
Assert.assertTrue(((String)((RestException)
ex).getResponse().getEntity()).contains(exceptionDetail));
}
```
Fix the code style. BTW, I'm wondering why the checkstyle plugin doesn't
check the blanks.
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -1148,4 +1149,21 @@ public void testAdminTerminatePartitionedTopic() throws
Exception{
Assert.assertEquals(e.getMessage(), "Termination of a
non-partitioned topic is not allowed using partitioned-terminate, please use
terminate commands.");
}
}
+
+ /**
+ * Fix issue 13573
+ */
Review comment:
Remove this meaningless comment.
--
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]