Refactored JUnit tests