Implemented most of junit testing code