Refactored code and test that AST transformation is not applied when target class has a not method