At this point in the tutorial, you can use the test class
to test the code that you just wrote. This lesson is optional, but
shows you how to run the test class.
To run the test class:
- Open the InventoryLevelsDataTest.java file for editing
by double-clicking the file in the Package Explorer.
- Add this simple method and save the file:
short inventoryYear = 2007;
short inventoryMonth = 1;
int warehouseBranchCode = 7;
int productNumber = 10110;
Integer getQuantityShipped = data.getQuantityShipped(inventoryYear,inventoryMonth,warehouseBranchCode,productNumber);
SampleUtil.println("Result for getQuantityShipped():" + getQuantityShipped.toString());
- In the Package Explorer, right-click
the file and select .
- In the Run Configurations window,
double-click Java Application.
A new run configuration named InventoryLevelsDataTest opens. This
run configuration will run the InventoryLevelsDataTest class.
- On the Arguments page of the Run
Configurations window, type the connection URL, user ID,
and password for the connection to the GSDB database, as in this example.
Figure 1. Typing the connection URL, user ID, and password
on the Arguments page of the Run Configurations window
- Click Apply, then click Run. The results appear in the Console view
for all of the SQL statements that InventoryLevelsDataTest runs. The
following figure highlights the result for the getQuantityShipped()
method.
Figure 2. The results of running InventoryLevelsDataTest,
with the result of the getQuantityShipped() method highlighted