Add Javadocs to JUnit and fix several bugs