added junit tests for part 4. had to switch some methods to public in order to do so.