mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Introduce @Template and @TemplateCollection annotations
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package tech.picnic.errorprone.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import javax.annotation.meta.TypeQualifierDefault;
|
||||
|
||||
/**
|
||||
* Links the test method to the Refaster template under test. This allows for more extensive
|
||||
* automatic verification of the tests. For instance, verify that every template has a test and the
|
||||
* provided Refaster template _does_ change the content of the test method when it is applied.
|
||||
*/
|
||||
@TypeQualifierDefault(ElementType.METHOD)
|
||||
public @interface Template {
|
||||
/**
|
||||
* The class of the Refaster template that should be applied to the method body of the test
|
||||
* method.
|
||||
*
|
||||
* @return class of the Refaster template
|
||||
*/
|
||||
Class<?> value();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package tech.picnic.errorprone.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import javax.annotation.meta.TypeQualifierDefault;
|
||||
|
||||
/**
|
||||
* Links the `*TemplatesTest{Input,Output} file to the collection of Refaster templates that are
|
||||
* tested in the class annotated with this annotation. As a value it should reference a class that
|
||||
* contains a collection of Refaster templates.
|
||||
*
|
||||
* <p>As a result of this annotation, we can perform additional validations. For instance, make sure
|
||||
* that the order of the templates matches the order in which the Refaster templates are defined.
|
||||
*/
|
||||
@TypeQualifierDefault(ElementType.TYPE)
|
||||
public @interface TemplateCollection {
|
||||
/**
|
||||
* The class of the Refaster template that should be applied to the method body of the test
|
||||
* method.
|
||||
*
|
||||
* @return class of the Refaster template
|
||||
*/
|
||||
Class<?> value();
|
||||
}
|
||||
Reference in New Issue
Block a user