Q:

Custom sonar rule for annotation parameters check

I have a task to create custom rule using SonarJava.  Rule purpose is checking methods.  If method is annottated with @Test it also needs to have @TestInfo annotation with not empty testCaseId parameter. 
This is what I have prepared:
public class AvoidEmptyTestCaseIdParameterRule extends IssuableSubscriptionVisitor {

private static final String TEST_ANNOTATION_PATH = "org.testng.annotations. Test";
private static final String TEST_INFO_ANNOTATION_PATH = "toolkit.utils. TestInfo";

@Override
public List<Tree. Kind> nodesToVisit() {
    return ImmutableList.of(Tree. Kind. METHOD);
}

@Override
public void visitNode(Tree tree) {
    MethodTree methodTree = (MethodTree) tree;

    if (methodTree.symbol().metadata().isAnnotatedWith(TEST_ANNOTATION_PATH)) {
        if (methodTree.symbol().metadata().isAnnotatedWith(TEST_INFO_ANNOTATION_PATH)) {
            List<AnnotationInstance> annotations = methodTree.symbol().metadata().annotations();
            for (int i = 0; i < annotations.size(); i++) {
                if (annotations.get(i).symbol().name().equals("TestInfo")
                        && ! testInfoAnnotationContainsNonEmptyTestCaseIdParameter(annotations.get(i))) {
                    reportIssue(methodTree.simpleName(),
                            "Method annotated with @TestInfo should have not empty testCaseId parameter");
                }
            }
        } else {
            reportIssue(methodTree.simpleName(),
                    "Method annotated with @Test should also be annotated with @TestInfo");
        }

    }

}

private boolean testInfoAnnotationContainsNonEmptyTestCaseIdParameter(AnnotationInstance annotation) {

    return <--this is where I stuck-->;
}
}

this is how my test class look:
public class TestClass {
    @Test
    @TestInfo(testCaseId = "", component = "Policy. IndividualBenefits")
    public void testMethod() {
    }
}

Question:
-Is it possible to get annotation parameters (properly or as String line)? 
-Is there other possible way to get this parameter? 

A:

I figured it out.  I switched to using Tree. Kind. ANNOTATION. 
This is the code for search of needed argument:
Arguments arguments = annotationTree.arguments();
            if (! arguments.isEmpty()) {
                for (int i = 0; i < arguments.size(); i++) {
                    String parameter = arguments.get(i).firstToken().text();
                    String parameterValue = arguments.get(i).lastToken().text();
                    if (isParameterTestCaseId(parameter) && isTestCaseIdEmpty(parameterValue)) {
                        reportIssue(arguments.get(i),
                                "Method annotated with @TestInfo should have not empty testCaseId parameter");
                    }
                }
            }

Methods for checking argument and its value:
private boolean isParameterTestCaseId(String parameter) {
    return parameter.matches("testCaseId");
}

private boolean isTestCaseIdEmpty(String parameterValue) {
    return parameterValue.length() ! = 0;
}

