Home
Running the JPA unit test
Finally, the JPA JUnit test can be executed. To run the AccountJPATest, do the following steps:
Make sure that the ITSOBANKderby connection is disconnected (with Embedded Derby you can only have one active connection to a database). You can verify this in the Data perspective, Data Source Explorer. If the ITSOBANKderby connection is available and active, right-click the connection and select Disconnect.
In the Package Explorer, right-click the AccountJPATest class and select Run | s Æ Run Configurations.
Double-click JUnit in the tree. A new JUnit Run Configuration for AccountJPATest class is created.
Select the Arguments tab (Figure | 3-6), and in the VM arguments field, type: -javaagent:c:/IBM/SDP75/runtimes/base_v7/plugins/com.ibm.ws.jpa.jar
Make sure to use the directory where Application Developer is installed.
Without this agent, the JPA entities are not found.
Figure 23-6 Run configuration arguments
Click Apply, then click Run.
The JUnit view opens showing that the AccountJPATest test case was successful (Figure | 3-7).
Figure 23-7 JUnit JPA test case was successful
ibm.com/redbooks