You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2020/06/30 13:56:38 UTC

[GitHub] [lucenenet] NightOwl888 opened a new issue #301: False positives in try-catch blocks with Asserts revealed when using NUnit 3.10.0+

NightOwl888 opened a new issue #301:
URL: https://github.com/apache/lucenenet/issues/301


   Some of the test asserts are structured in a way that makes them potentially catch any exception that NUnit throws to implement its behavior. For example:
   
   ```c#
   try
   {
       // Test condition (supposed to throw)
       Assert.Fail("Did not throw");
   }
   catch (Exception)
   {
       // ok
   }
   ```
   
   We were getting some false positives in NUnit 3.9.0 and prior, since in those cases the catch block would swallow the exception that NUnit throws as well as the intended exception. However, NUnit [patched this behavior in 3.10.0](https://groups.google.com/forum/#!topic/nunit-discuss/GMTnMheFYxk) and now these tests are failing.
   
   Upgrading to a newer version of NUnit requires us to fix these broken statements that are falling through. In addition, we should also change these to `Assert.Throws` or `Assert.ThrowsAnyOf` to make things easier to manage.
   
   Fortunately, I have reviewed the issues and none of the problems affect end users, they were just problems with injecting mock settings during testing. This issue is closely related to #267.
   
   


----------------------------------------------------------------
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] [lucenenet] NightOwl888 closed issue #301: False positives in try-catch blocks with Asserts revealed when using NUnit 3.10.0+

Posted by GitBox <gi...@apache.org>.
NightOwl888 closed issue #301:
URL: https://github.com/apache/lucenenet/issues/301


   


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