October 2000
Intermediate to advanced
288 pages
5h 45m
English
Somehow we must associate a Searcher with our GUI, and verify that we display its results.
We'll give our panel two methods, getSearcher() and setSearcher(),that will associate a Searcher with the panel. This decision lets us write another test:
public void testSearcherSetup() {
Searcher s = new Searcher() {
public Result search(Query q) {return null;}
};
SearchPanel panel = new SearchPanel();
assert ("Searcher not set", panel.getSearcher() != s);
panel.setSearcher(s);
assert("Searcher now set", panel.getSearcher() == s);
}
The compile fails, so bounce over to the SearchPanel, add the methods, run the tests again, and they fail. Implement the set/get methods, and the test passes.
The panel still can't do much, but now ...
Read now
Unlock full access