Created
February 11, 2010 20:15
-
-
Save ecerulm/301901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NoteFinderLuceneImplTest implements Lookup.Provider { | |
private static NoteFinderLuceneImpl instance; | |
private Lookup lookup; | |
private InstanceContent ic = new InstanceContent (); // see http://bit.ly/aL7q9M for more details | |
public NoteFinderLuceneImplTest() { | |
} | |
@BeforeClass | |
public static void setUpClass() throws Exception { | |
//to check that you actually replaced the default lookup | |
System.out.println(Lookup.getDefault()); | |
ic.add(new TestNoteRepository()); //TestNoteRepository will show up in the | |
//default lookup. | |
//a lookup for NoteRepository.class should return the TestNoteRepository that we | |
//just created (TestNoteRepository implements NoteRepository) | |
NoteRepository testNoteRepository = Lookup.getDefault().lookup(NoteRepository.class); | |
//add some test data to the NoteRepository | |
//testNoteRepository.add(note1) | |
//testNoteRepository.add(note1) | |
instance = new NoteFinderLuceneImpl(); | |
instance.rebuildIndex(); //rebuilIndex actually | |
//calls Lookup.getDefault().lookup(NoteRepository.class) | |
} | |
@Test | |
public void testFind() { | |
// TODO | |
// instance.findNote(xxx); | |
} | |
public Lookup getLookup() { | |
if (lookup == null) { | |
//TestNoteRepository implements NoteRepository | |
lookup = new AbstractLookup (ic); | |
} | |
return lookup; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment