git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/branches/newtrunk@925631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2010-03-20 16:03:37 +00:00
parent aa9b85c260
commit 25d2c54856
1 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ import java.io.File;
*/ */
public class RAMDirectoryFactoryTest extends TestCase { public class RAMDirectoryFactoryTest extends TestCase {
public void testOpenReturnsTheSameForSamePath() throws IOException { public void testOpenReturnsTheSameForSamePath() throws IOException {
final Directory directory = new RAMDirectory(); final Directory directory = new RefCntRamDirectory();
RAMDirectoryFactory factory = new RAMDirectoryFactory() { RAMDirectoryFactory factory = new RAMDirectoryFactory() {
@Override @Override
Directory openNew(String path) throws IOException { Directory openNew(String path) throws IOException {
@ -40,16 +40,16 @@ public class RAMDirectoryFactoryTest extends TestCase {
String path = "/fake/path"; String path = "/fake/path";
Directory dir1 = factory.open(path); Directory dir1 = factory.open(path);
Directory dir2 = factory.open(path); Directory dir2 = factory.open(path);
assertEquals("RAMDirectoryFactory should not create new instance of RAMDirectory " + assertEquals("RAMDirectoryFactory should not create new instance of RefCntRamDirectory " +
"every time open() is called for the same path", directory, dir1); "every time open() is called for the same path", directory, dir1);
assertEquals("RAMDirectoryFactory should not create new instance of RAMDirectory " + assertEquals("RAMDirectoryFactory should not create new instance of RefCntRamDirectory " +
"every time open() is called for the same path", directory, dir2); "every time open() is called for the same path", directory, dir2);
} }
public void testOpenSucceedForEmptyDir() throws IOException { public void testOpenSucceedForEmptyDir() throws IOException {
RAMDirectoryFactory factory = new RAMDirectoryFactory(); RAMDirectoryFactory factory = new RAMDirectoryFactory();
Directory dir = factory.open("/fake/path"); Directory dir = factory.open("/fake/path");
assertNotNull("RAMDirectoryFactory should create RAMDirectory even if the path doen't lead " + assertNotNull("RAMDirectoryFactory should create RefCntRamDirectory even if the path doen't lead " +
"to index directory on the file system", dir); "to index directory on the file system", dir);
} }
} }