You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/02/26 11:32:23 UTC

[GitHub] [ignite] atris opened a new pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

atris opened a new pull request #8833:
URL: https://github.com/apache/ignite/pull/8833


   This commit introduces expectThrows method which allows tests to capture a block of code and define an
   expectation to throw a certain type of exception with a message to print if the block of code does not
   do so.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] nizhikov commented on pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
nizhikov commented on pull request #8833:
URL: https://github.com/apache/ignite/pull/8833#issuecomment-786593785


   How new method differs from `GridTestUtils#assertThrows`?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] Mmuzaf commented on a change in pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
Mmuzaf commented on a change in pull request #8833:
URL: https://github.com/apache/ignite/pull/8833#discussion_r583580520



##########
File path: modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnitAssertAware.java
##########
@@ -203,4 +208,64 @@ protected static void assertNotSame(Object unexpected, Object actual) {
     protected static void assertNotSame(String msg, Object exp, Object actual) {
         Assert.assertNotSame(msg, exp, actual);
     }
+
+    /** A runnable that can throw any checked exception. */
+    @FunctionalInterface
+    public interface ThrowingRunnable {
+        void run() throws Throwable;
+    }
+
+    /** Checks a specific exception class is thrown by the given runnable, and returns it. */
+    public static <T extends Throwable> T expectThrows(

Review comment:
       Hello, can you check these methods? Are they the same?
   
   ```
   org.apache.ignite.testframework.GridTestUtils#assertThrows
   
   org.apache.ignite.testframework.GridTestUtils#assertThrowsWithCause
   
   org.apache.ignite.testframework.GridTestUtils#assertThrowsAnyCause
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] atris commented on pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
atris commented on pull request #8833:
URL: https://github.com/apache/ignite/pull/8833#issuecomment-786592080


   @alamar @SammyVimes 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] atris closed pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
atris closed pull request #8833:
URL: https://github.com/apache/ignite/pull/8833


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] ibessonov commented on pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
ibessonov commented on pull request #8833:
URL: https://github.com/apache/ignite/pull/8833#issuecomment-786595213


   Agree with @nizhikov, wanted to write the same 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] atris commented on pull request #8833: IGNITE-14225: Introduce expectThrows As A Helper Test Method

Posted by GitBox <gi...@apache.org>.
atris commented on pull request #8833:
URL: https://github.com/apache/ignite/pull/8833#issuecomment-786614875


   My bad, for some reason, I did not find those method! Closing this PR.


----------------------------------------------------------------
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:
users@infra.apache.org