Code refactoring for TestNG