Testing on the Client
Our code in OracleJavaSecure is intended to be run as a client-server application to encrypt data on one end (e.g., server) and decrypt it at the other (e.g., client). However, it is nice to be able to test our code without introducing some of the complexities of client-server communication. So we will test all of our code so far on the client only. On the client we will generate the keys, encrypt data with the private key, build an equivalent public key from the public key artifacts, and decrypt data with the equivalent public key.
Writing the main() Method
In my experience, the best place to put test code is right in the class whose functions you are testing. Obviously you have to run your code in order to test it, and ...