eolivelli commented on pull request #11238:
URL: https://github.com/apache/pulsar/pull/11238#issuecomment-878125734


   `Assert.expectThrows(SchemaSerializationException.class, () -> 
p.send(contentV1));`
   
   expectThows will execute the code wrapped by a try/catch block, this is 
TestNG code:
   
   ```
   public static <T extends Throwable> T expectThrows(
         Class<T> throwableClass, ThrowingRunnable runnable) {
       try {
         runnable.run();
       } catch (Throwable t) {
         if (throwableClass.isInstance(t)) {
           return throwableClass.cast(t);
         } else {
           String mismatchMessage =
               String.format(
                   "Expected %s to be thrown, but %s was thrown",
                   throwableClass.getSimpleName(), 
t.getClass().getSimpleName());
   
           throw new AssertionError(mismatchMessage, t);
         }
       }
       String message =
           String.format(
               "Expected %s to be thrown, but nothing was thrown", 
throwableClass.getSimpleName());
       throw new AssertionError(message);
     }
   ```
   
   


-- 
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]


Reply via email to