Javadoc and a little refactor of the test code