Refactoring plus basic jUnit test