code refactoring. Add one unit test for Java project.