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 2017/05/18 14:42:59 UTC

lucenenet git commit: Updated TestDefaultDocValuesFormatFactory and TestDefaultPostingsFormatFactory to account for new lazy initialization behavior.

Repository: lucenenet
Updated Branches:
  refs/heads/master 6c5e2217d -> 1a980c496


Updated TestDefaultDocValuesFormatFactory and TestDefaultPostingsFormatFactory to account for new lazy initialization behavior.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1a980c49
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1a980c49
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1a980c49

Branch: refs/heads/master
Commit: 1a980c4960becdbe74dc8bba31b2306da0087cef
Parents: 6c5e221
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu May 18 21:38:34 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu May 18 21:38:34 2017 +0700

----------------------------------------------------------------------
 .../Codecs/TestDefaultDocValuesFormatFactory.cs  | 18 ++++++++++++------
 .../Codecs/TestDefaultPostingsFormatFactory.cs   | 19 +++++++++++++------
 2 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1a980c49/src/Lucene.Net.Tests/Support/Codecs/TestDefaultDocValuesFormatFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/Codecs/TestDefaultDocValuesFormatFactory.cs b/src/Lucene.Net.Tests/Support/Codecs/TestDefaultDocValuesFormatFactory.cs
index 09af8f9..d8c4bea 100644
--- a/src/Lucene.Net.Tests/Support/Codecs/TestDefaultDocValuesFormatFactory.cs
+++ b/src/Lucene.Net.Tests/Support/Codecs/TestDefaultDocValuesFormatFactory.cs
@@ -46,8 +46,9 @@ namespace Lucene.Net.Codecs
 
         private class ScanningDocValuesFormatFactory : DefaultDocValuesFormatFactory
         {
-            public ScanningDocValuesFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.ScanForDocValuesFormats(this.GetType().GetTypeInfo().Assembly);
             }
         }
@@ -78,8 +79,9 @@ namespace Lucene.Net.Codecs
 
         private class ExplicitDocValuesFormatFactory : DefaultDocValuesFormatFactory
         {
-            public ExplicitDocValuesFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutDocValuesFormatType(typeof(PrivateDocValuesFormat));
             }
         }
@@ -96,8 +98,9 @@ namespace Lucene.Net.Codecs
 
         private class InvalidNameDocValuesFormatFactory : DefaultDocValuesFormatFactory
         {
-            public InvalidNameDocValuesFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutDocValuesFormatType(typeof(InvalidNamedDocValuesFormat));
             }
         }
@@ -105,13 +108,15 @@ namespace Lucene.Net.Codecs
         [Test]
         public void TestInvalidName()
         {
-            Assert.Throws<ArgumentException>(() => new InvalidNameDocValuesFormatFactory());
+            var factory = new InvalidNameDocValuesFormatFactory();
+            Assert.Throws<ArgumentException>(() => factory.GetDocValuesFormat("SomeFormat"));
         }
 
         private class CustomNameDocValuesFormatFactory : DefaultDocValuesFormatFactory
         {
-            public CustomNameDocValuesFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutDocValuesFormatType(typeof(CustomNamedDocValuesFormat));
             }
         }
@@ -150,8 +155,9 @@ namespace Lucene.Net.Codecs
 
         private class ReplaceDocValuesFormatFactory : DefaultDocValuesFormatFactory
         {
-            public ReplaceDocValuesFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutDocValuesFormatType(typeof(TestLucene40DocValuesFormat));
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1a980c49/src/Lucene.Net.Tests/Support/Codecs/TestDefaultPostingsFormatFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Support/Codecs/TestDefaultPostingsFormatFactory.cs b/src/Lucene.Net.Tests/Support/Codecs/TestDefaultPostingsFormatFactory.cs
index c40ee11..584d137 100644
--- a/src/Lucene.Net.Tests/Support/Codecs/TestDefaultPostingsFormatFactory.cs
+++ b/src/Lucene.Net.Tests/Support/Codecs/TestDefaultPostingsFormatFactory.cs
@@ -49,8 +49,9 @@ namespace Lucene.Net.Codecs
 
         private class ScanningPostingsFormatFactory : DefaultPostingsFormatFactory
         {
-            public ScanningPostingsFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.ScanForPostingsFormats(this.GetType().GetTypeInfo().Assembly);
             }
         }
@@ -85,8 +86,9 @@ namespace Lucene.Net.Codecs
 
         private class ExplicitPostingsFormatFactory : DefaultPostingsFormatFactory
         {
-            public ExplicitPostingsFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutPostingsFormatType(typeof(PrivatePostingsFormat));
             }
         }
@@ -103,8 +105,9 @@ namespace Lucene.Net.Codecs
 
         private class InvalidNamePostingsFormatFactory : DefaultPostingsFormatFactory
         {
-            public InvalidNamePostingsFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutPostingsFormatType(typeof(InvalidNamedPostingsFormat));
             }
         }
@@ -112,13 +115,16 @@ namespace Lucene.Net.Codecs
         [Test]
         public void TestInvalidName()
         {
-            Assert.Throws<ArgumentException>(() => new InvalidNamePostingsFormatFactory());
+            var factory = new InvalidNamePostingsFormatFactory();
+
+            Assert.Throws<ArgumentException>(() => factory.GetPostingsFormat("SomeFormat"));
         }
 
         private class CustomNamePostingsFormatFactory : DefaultPostingsFormatFactory
         {
-            public CustomNamePostingsFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutPostingsFormatType(typeof(CustomNamedPostingsFormat));
             }
         }
@@ -157,8 +163,9 @@ namespace Lucene.Net.Codecs
 
         private class ReplacePostingsFormatFactory : DefaultPostingsFormatFactory
         {
-            public ReplacePostingsFormatFactory()
+            protected override void Initialize()
             {
+                base.Initialize();
                 base.PutPostingsFormatType(typeof(TestLucene40PostingsFormat));
             }
         }