Searching for an Understanding

We’re tasked with making some enhancements to the search capabilities of our application. We know we’ll be changing the util.Search class, but none of us is familiar with exactly what the Search class does. We turn to the tests. Well, test. We have only one test, and at first glance we roll our eyes in frustration. What in the world is this test trying to prove?

iloveyouboss/test-1/test/util/SearchTest.java
 
import​ java.io.*;
 
import​ java.net.*;
 
import​ java.util.*;
 
import​ org.junit.*;
 
import​ java.util.logging.*;
 
import​ static org.hamcrest.CoreMatchers.*;
 
import​ static org.junit.Assert.*;
 
 
public​ ​class​ SearchTest {
 
@Test
 
public​ ​void​ testSearch() {
 
try​ {
 
String​ pageContent ...

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.