Q: TestNG 7.0.1 deprecated method for getRetryAnalyzer() The following method getRetryAnalyzer are deprecated in testng 7.0.1. Here is my code:
public ITestAnnotation annotations;

@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
    annotations =annotation;
    if(null == annotation.getRetryAnalyzer()) {
        annotation.setRetryAnalyzer(Retry.class);
    }
}

@Override
public void onTestStart(ITestResult result) {
}

@Override
public void onTestSuccess(ITestResult result) {
    ((Retry) annotations.getRetryAnalyzer()).reset();
    
}

@Override
public void onTestFailure(ITestResult result) {
    ((Retry) annotations.getRetryAnalyzer()).reset();
}

I tried to replace it with getRetryAnalyzerClass() but it was not working. Can anyone tell me how I can fix this deprecated method?

A: This method stands deprecated as of TestNG 7.0.0. Please use {ITestAnnotation.getRetryAnalyzerClass()} instead.
Check the following link
the code will be as following:
Class<? extends IRetryAnalyzer> retry = testannotation.getRetryAnalyzerClass();

