TestSearchModelpublic class TestSearchModel extends TestCase
Constructors Summary |
---|
public TestSearchModel(String name)
super(name);
|
Methods Summary |
---|
public void | testAsynchronousSearch()
MockSearchModelListener mockListener = new MockSearchModelListener();
SearchModel sm = new PersonSearchModel();
sm.search("eric", mockListener);
synchronized (mockListener) {
mockListener.wait(10000);
}
SearchModelEvent evt = mockListener.getSearchModelEvent();
assertNotNull("Search timed out", evt);
List results = evt.getSearchResult();
assertEquals("Number of results", 1, results.size());
Person p = (Person) results.get(0);
assertEquals("Result", "Eric", p.getFirstName());
| public void | testSynchronousSearch()
SearchModel sm = new PersonSearchModel();
// perform a search
List results = sm.search("eric");
assertEquals("Number of results", 1, results.size());
Person p = (Person) results.get(0);
assertEquals("Result", "Eric", p.getFirstName());
// do another search
results = sm.search("*");
assertEquals("Number of results", 4, results.size());
|
|