@Test
void fullyQualifedClass() {
rewriteRun(
java(
"""
package a;
public interface FastTests {}
"""
),
java(
"""
package b;
import org.junit.experimental.categories.Category;
@Category(a.FastTests.class)
public class B {
}
""",
"""
package b;
import org.junit.jupiter.api.Tag;
@Tag("FastTests")
public class B {
}
"""
)
);
}
yields:
java.lang.AssertionError: Failed to parse sources or run recipe
Caused by: org.openrewrite.internal.RecipeRunException: Exception while visiting project file 'b\B.java (in B)', caused by: java.lang.ClassCastException: class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$Identifier (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$Identifier are in unnamed module of loader 'app'), at org.openrewrite.java.testing.junit5.CategoryToTag$CategoryToTagVisitor.lambda$categoryAnnotationToTagAnnotations$0(CategoryToTag.java:115)
Test case:
yields: