Refactoring: use JUnit tests