added Tests and javadoc