You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/06/30 21:58:53 UTC
[lucenenet] 06/09:
Lucene.Net.Tests.Index.TestIndexWriterExceptions::TestExceptionDocumentsWriterInit():
Fixed issue with swallowing NUnit's AssertionException by using
Assert.Throws.
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 178faadc07b129ba16197e3ca24391288d436d1b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Jun 30 12:52:24 2020 +0700
Lucene.Net.Tests.Index.TestIndexWriterExceptions::TestExceptionDocumentsWriterInit(): Fixed issue with swallowing NUnit's AssertionException by using Assert.Throws.
---
.../Index/TestIndexWriterExceptions.cs | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index 0e904d0..00b79bb 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -503,17 +503,20 @@ namespace Lucene.Net.Index
doc.Add(NewTextField("field", "a field", Field.Store.YES));
w.AddDocument(doc);
testPoint.DoFail = true;
- try
- {
- w.AddDocument(doc);
- Assert.Fail("did not hit exception");
- }
-#pragma warning disable 168
- catch (Exception re)
-#pragma warning restore 168
- {
- // expected
- }
+
+ // LUCENENET: Don't swallow NUnit's assert exception
+ Assert.Throws<Exception>(() => w.AddDocument(doc), "did not hit exception");
+// try
+// {
+// w.AddDocument(doc);
+// Assert.Fail("did not hit exception");
+// }
+//#pragma warning disable 168
+// catch (Exception re)
+//#pragma warning restore 168
+// {
+// // expected
+// }
w.Dispose();
dir.Dispose();
}