refactored test cases from main into junit tests