Refactored allot of repeating test code

Added javadoc comments