refactoring java test class