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

   See #259.
   
   In `TestIndexWriter`, the `GetEnumerator()` return instance is supposed to 
throw random exceptions for the test, but it is currently commented out and 
returning an instance that doesn't throw exceptions. So, we are missing test 
conditions.
   
   
https://github.com/apache/lucene/blob/releases/lucene-solr/4.8.0/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java#L2242-L2276
   
   Furthermore, the anonymous class it returns needs to be refactored into an 
enumerator.
   
   > **NOTE:** As this is being written the name of the class is being changed 
from `RandomFailingFieldIterable` to `RandomFailingFieldEnumerable` for 
Lucene.NET. We should wait for the rename patch before fixing this to avoid 
merge conflicts.
   
   ```c#
           private class RandomFailingFieldEnumerable : 
IEnumerable<IEnumerable<IIndexableField>>
           {
               internal readonly IList<IEnumerable<IIndexableField>> docList;
               internal readonly Random random;
   
               public 
RandomFailingFieldEnumerable(IList<IEnumerable<IIndexableField>> docList, 
Random random)
               {
                   this.docList = docList;
                   this.random = random;
               }
   
               public virtual IEnumerator<IEnumerable<IIndexableField>> 
GetEnumerator()
               {
                   return docList.GetEnumerator();
                   //return new EnumeratorAnonymousClass(this, docIter);
               }
   
               IEnumerator IEnumerable.GetEnumerator()
               {
                   return GetEnumerator();
               }
   
               /*
             private class EnumeratorAnonymousClass : 
IEnumerator<IEnumerable<IndexableField>>
             {
                 private readonly RandomFailingFieldIterable outerInstance;
   
                 private IEnumerator<IEnumerable<IndexableField>> DocIter;
   
                 public EnumeratorAnonymousClass(RandomFailingFieldIterable 
outerInstance, IEnumerator<IEnumerable<IndexableField>> docIter)
                 {
                     this.outerInstance = outerInstance;
                     this.DocIter = docIter;
                 }
   
                 public virtual bool HasNext()
                 {
                   return DocIter.hasNext();
                 }
   
                 public virtual IEnumerable<IndexableField> Next()
                 {
                   if (outerInstance.Random.Next(5) == 0)
                   {
                     throw RuntimeException.Create("boom");
                   }
                   return DocIter.Next();
                 }
   
                 public virtual void Remove()
                 {
                     throw UnsupportedOperationException.Create();
                 }
             }*/
           }
   ```
   
   Fixing this may (but most likely will not) cause test failures that will 
need to be debugged and patched if they exist.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to