@@ -125,21 +125,16 @@ public J.NewClass visitNewClass(J.NewClass newClass, ExecutionContext executionC
125125 return nc ;
126126 }
127127
128- @ Override
129- public J .MethodDeclaration visitMethodDeclaration (J .MethodDeclaration method , ExecutionContext executionContext ) {
130- J .MethodDeclaration md = super .visitMethodDeclaration (method , executionContext );
131- if (md .getLeadingAnnotations ().stream ().anyMatch (this ::isBeforeAnnotation )) {
132- //noinspection ConstantConditions
133- getCursor ().putMessage ("before-method" , getCursor ().firstEnclosing (J .ClassDeclaration .class ));
134- }
135- return md ;
136- }
128+ //FIXME. add TestMethod statements.
129+ // @Override
130+ // public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, ExecutionContext executionContext) {
131+ // J.MethodDeclaration md = super.visitMethodDeclaration(method, executionContext);
132+ // return md;
133+ // }
137134
138135 private boolean isBeforeAnnotation (J .Annotation annotation ) {
139136 return TypeUtils .isOfClassType (annotation .getType (), "org.junit.Before" ) || TypeUtils .isOfClassType (annotation .getType (), "org.junit.jupiter.api.BeforeEach" );
140137 }
141-
142-
143138 };
144139 }
145140
@@ -155,7 +150,7 @@ public AddBeforeEachMethod(J.VariableDeclarations varDecls, J.ClassDeclaration e
155150 @ Override
156151 public J .ClassDeclaration visitClassDeclaration (J .ClassDeclaration classDecl , ExecutionContext executionContext ) {
157152 J .ClassDeclaration cd = super .visitClassDeclaration (classDecl , executionContext );
158- if (getCursor ().isScopeInPath ( enclosingClass )) {
153+ if (enclosingClass . getId ().equals ( cd . getId () )) {
159154 String t = "@BeforeEach\n " +
160155 "public void setup(TestInfo testInfo) {\n " +
161156 " Optional<Method> testMethod = testInfo.getTestMethod();\n " +
0 commit comments