Skip to content

Commit

Permalink
Strengthening tests and adding TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
synhershko committed Jan 5, 2015
1 parent 26de7b8 commit 4560053
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,26 @@ public virtual void TestDeleteFile()
}

// LUCENE-3382 -- make sure we get exception if the directory really does not exist.
[Test]
[Test, Timeout(int.MaxValue)]
public virtual void TestNoDir()
{
//Directory tempDir = CreateTempDir("doesnotexist");

string tempDir = Path.GetTempPath();
if (tempDir == null)
throw new IOException("java.io.tmpdir undefined, cannot run test");
DirectoryInfo TempDir = new DirectoryInfo(Path.Combine(tempDir, "RAMDirIndex"));
// LUCENENET TODO mysterious failure - FSDirectory recreates the folder by design, not sure why this passes for Java Lucene

System.IO.Directory.Delete(TempDir.FullName, true);
Directory dir = new NRTCachingDirectory(NewFSDirectory(TempDir), 2.0, 25.0);
try
{
DirectoryReader.Open(dir);
Assert.Fail("did not hit expected exception");
}
catch (NoSuchDirectoryException nsde)
var tempDir = CreateTempDir("doesnotexist").FullName;
System.IO.Directory.Delete(tempDir, true);
using (Directory dir = new NRTCachingDirectory(NewFSDirectory(new DirectoryInfo(tempDir)), 2.0, 25.0))
{
// expected
try
{
Assert.False(System.IO.Directory.Exists(tempDir));
DirectoryReader.Open(dir);
Assert.Fail("did not hit expected exception");
}
catch (NoSuchDirectoryException)
{
// expected
}
}
dir.Dispose();
}

// LUCENE-3382 test that we can add a file, and then when we call list() we get it back
Expand Down

0 comments on commit 4560053

Please sign in to comment.