labs / tiddlers / content / labs / lab03 / _Labs_03_Testing the 'Search'

This test should check that the correct student is displayed when the user searches for a student via their student ID.

You will need to stub the getById method since that is the method that the <

> button calls. The stub code goes in the setUp method and looks like:

Student jack = new Student(1111, "Jack", "Chemistry");

This stub will only return the student jack when the ID 1111 is passed to the getById method. The purpose of these stub methods is to do provide the bare minimum functionality that allows the test to operate, using hard-coded data that can be checked in the test.

The robot will need to enter the student's ID (use the ID that the getById stub expects) into the search box, and click the <

> button.

You can find the component names on lines 26--28 in the constructor for StudentViewer.

Since the getById method should have been called when the button was clicked, the test should verify that this is the case and that the correct parameter was passed. The code for this looks like:


The test should then check that the list is displaying the correct student. This code is similar to the code that you used in the previous test, except there will only be one student.