I am trying to write some annotations to help associate test methods with various metadata. My annotations so far include BugFix, UseCase and Requirement. My ultimate goal is to write an annotation handler to display which test cases are associated with individual bug fixes, usage examples, and requirements.
When I simply implemented this for my own project, I created enumerations specific to my project for each category of test association. For example, I had ProjectUseCase enumerations that I could pass as the value of the UseCase annotation for my testing methods. This made it easy to add additional use cases or change use cases in one place.
Now I would like to make this code available to other developers at my work. Of course, they will work on other projects, with various use cases, requirements and bug fixes.
Here are the issues I am facing:
- Enum cannot be extended, so I cannot have a basic UseCase enumeration that others can distribute for their own projects.
- Values for annotation properties must be constants. This prevents me from using the interface marker (TestAssociation) in my enumerations and using the TestAssociation interface for the values of my annotation. In addition, this prevents me from using String values in my annotation and passing the enumeration name when using the annotation, for example: @UseCase (ProjectUseCase.GENERAL.name ()).
, , , . , .
, , Enum ( ) , .
?
, - , .