You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/11/18 18:06:41 UTC

svn commit: r881838 - /incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs

Author: digy
Date: Wed Nov 18 17:06:41 2009
New Revision: 881838

URL: http://svn.apache.org/viewvc?rev=881838&view=rev
Log:
LUCENENET-280 TestProtectedCtors test on TestQueryParser fails

Modified:
    incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/QueryParser/TestQueryParser.cs?rev=881838&r1=881837&r2=881838&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs Wed Nov 18 17:06:41 2009
@@ -1146,23 +1146,18 @@
 		[Test]
 		public virtual void  TestProtectedCtors()
 		{
-			try
-			{
-				typeof(QueryParser).GetConstructor(new System.Type[]{typeof(CharStream)});
+            // If the return type is not null, then fail the assertion.
+			if (typeof(QueryParser).GetConstructor(new System.Type[]{typeof(CharStream)}) != null)
+            {
+                // Fail the assertion.
 				Assert.Fail("please switch public QueryParser(CharStream) to be protected");
 			}
-			catch (System.MethodAccessException nsme)
-			{
-				// expected
-			}
-			try
-			{
-				typeof(QueryParser).GetConstructor(new System.Type[]{typeof(QueryParserTokenManager)});
-				Assert.Fail("please switch public QueryParser(QueryParserTokenManager) to be protected");
-			}
-			catch (System.MethodAccessException nsme)
-			{
-				// expected
+
+            // Same for the constructor for the constructor with the query parser token manager.
+            if (typeof(QueryParser).GetConstructor(new System.Type[]{typeof(QueryParserTokenManager)}) != null)
+            {
+                // Fail the assertion.
+                Assert.Fail("please switch public QueryParser(QueryParserTokenManager) to be protected");
 			}
 		}
 	}