I am having some issues with the Groovy Validator project. Here is an email I sent to the Groovy user mailing list:
I am making some annotations to do validation on POGOs. The github project is here:
One of my annotations is @StringAnnotation, which has the properties minLength, maxLength and regEx. I also have annotations for ints, longs, floats and doubles.
I got them working with POGOs and POGOs that have the @Immutable annotation.
So far I have the annotations working for POGOs by calling a static method on a class called AnnotationProcessor, and the annotations are handled by @Immutable objects with AstImmutableConstructorTransform.
I decided I would like to process the individual annotations with their own processor, so I started with the @StringAnnotation.
The AST class is here:
There are a lot of println statements since I am trying to figure all of this stuff out.
The issue that I am having is that when I run some tests the StringAnnotationTransform does not seem to work. All the strings wind up null in my tests.
Here is the command I use:
gradle clean; gradle -Dtest.single=BookSequelTest test -info
Yet, when I try these in the Groovy console (which I run with “gradle console”) things work as expected.
Why does everything work in the console but not in tests? Any ideas?
Image from the Orsha Gospel, a 13th-century Slavonic manuscript housed at the V.I. Vernadsky National Library of Ukraine (Wikipedia page here), image from World Document Library, image assumed allowed under Fair Use.