October 2000
Intermediate to advanced
288 pages
5h 45m
English
A search returns a set of results. When something returns a list of values, I'm always interested to see how it will behave when it returns 0, 1, or an arbitrary number.
Because this is a unit test, I don't want to depend on the real Searcher implementations; I'd rather create my own for testing purposes. This lets me control behavior in a fine-grained way. Here I'll create a new Searcher called TestSearcher. We'll have the query string be an integer, which will tell how many items to return. We'll name the items "a0" (for first author), "t1" (second title), and so on.
But first, a test. (Notice this is a test of our testing class, not of our GUI.)
public void testTestSearcher() { assertEquals(new Query("1").getValue(), ...Read now
Unlock full access