refactor tests, fix javadoc