Error Notification

In our imaginary scenario, let's assume that we have a new feature request. Users want getTopN to return the best n items, even if the list passed in is not sorted. So far, none of our tests uses a clearly unsorted list as input to getTopN. So let's add one to

  public void testTopThreeIntsUnsorted() {
    Integer one = new Integer(1);
    Integer two = new Integer(2);
    Integer three = new Integer(3);
    Integer four = new Integer(4);
    Integer five = new Integer(5);
    Integer six = new Integer(6);

        Arrays.asList(new Integer[] { one, two, three }),
            Arrays.asList(new Integer[] { four, one, two, three, five, six })));

We don't expect this test to pass. Save the file, and soon, continuous testing springs into action. You'll see several indications of the failing test, similar to what you see when there is a compile error in your code:

Although the same kind of notifications are used for compile errors and test failures, the two kinds of problems are different. Most importantly, compile errors are usually indicated near the code that needs to be changed, whereas test failures are indicated on the test method that failed. To fix a test failure will often require making a change in the code being tested, somewhere far away from the failure notification.