add JavaDoc and test