-
Notifications
You must be signed in to change notification settings - Fork 651
Closed
ModerRAS/TelegramSearchBot
#158Labels
hacktoberfest-acceptedPR is approved for Hacktoberfest even if not mergedPR is approved for Hacktoberfest even if not mergedis:bug
Description
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.
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
RandomFailingFieldIterabletoRandomFailingFieldEnumerablefor Lucene.NET. We should wait for the rename patch before fixing this to avoid merge conflicts.
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 RandomFailingFieldEnumerable outerInstance;
private IEnumerator<IEnumerable<IndexableField>> DocIter;
public EnumeratorAnonymousClass(RandomFailingFieldEnumerable 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.
Metadata
Metadata
Assignees
Labels
hacktoberfest-acceptedPR is approved for Hacktoberfest even if not mergedPR is approved for Hacktoberfest even if not mergedis:bug