Java Reference
In-Depth Information
Testing the PasswordException Classes
and Subclasses
A user must be added before attempting to log on to use the stock list application
to test the PasswordException classes and subclasses. New users are added by typ-
ing appropriate values in the User Name text box and the Password text box, and
then clicking the Add new user button. To change the password for an existing
user, type the user name in the User Name text box and the current password in
the Password text box and then click the Change user pswd button. To log on as
an existing user, type the user name in the User Name text box and the current
password in the Password text box and then click the Log on button.
Testing the PasswordException Classes and Subclasses
To test the application sufficiently, both valid and invalid inputs should be
tested. The following steps use the StockListDemo test application to test the
PasswordException classes and subclasses and view the various exceptions
generated by valid and invalid inputs.
To Test the PasswordException Classes and Subclasses
1. Click Run Java Application on the Tools menu.
The Log on or Maintain User window displays (Figure 10-1a on page 605).
2. Add a new user by typing user01 , or a name of your choice, in the User
Name text box and admin01 in the Password text box. Click the Add
new user button.
The new user is added to the list of users and the New user added dialog
box displays (Figure 10-1c on page 605).
3. Click the OK button.
The New user added dialog box closes. You may add as many users as
allowed by the variable, maxUsers, in the LogonFrame class, which currently
is set to 3.
4. In the Log on or Maintain User window, type user01 (or the user name
entered in the previous step) in the User Name text box and the
corresponding password, admin01, in the Password text box. Click the
Log on button. When the Log on Successful dialog box displays, click
the OK button.
The Add Stock Symbols window displays with the current user name
(Figure 10-1b on page 605).
5. Type MSFT , or a stock symbol of your choice, in the Symbol text box
and then click the Add Symbol button. Repeat this step, typing ORCL as
the stock symbol. Click the Click arrow to view list box arrow in the
View stock symbols area.
The added stock symbols are displayed in the drop-down list (Figure 10-1b).
Search WWH ::




Custom Search