ChangeAnnotation¶
Changing the annotation parameters.
Contents
Description¶
The changeAnnotation
action allows for the modification of annotation parameters
Configuration options¶
addParameter¶
Add a parameter to the annotation. Two properties can be set: name
(optional) and value
.
changeAnnotation:
addParameter:
value: "\"Reason to disable\""
- @Disabled
+ @Disabled("Reason to disable")
void thisTestMethodHasNoDisabledReason(){
Assertions.fail("This test is disabled and should not run");
}
changeAnnotation:
addParameter:
name: "value"
value: "\"my-value\""
- @MyAnnotation(param1 = "")
+ @MyAnnotation(param1 = "", value = "my-value")
private String s;
- @MyAnnotation
+ @MyAnnotation("my-value")
private int i;
changeAnnotation:
addParameter:
- name: "param3"
value: 5
- name: "param2"
value: "\"\""
- @MyAnnotation(param1 = "")
+ @MyAnnotaion(param1 = "", param2 = "", param3 = 5)
void myMethod() {
// ...
}
Note
The parameters will be added in alphabetical order
changeParameter¶
Change an existing parameter's name or value, depending on the options given.
removeParameter¶
Removes the parameter from the annotation that matches the given name in the withName
property.
changeAnnotation:
removeParameter:
- withName: "name"
- @MyAnnotation(name = "")
+ @MyAnnotation()
private String s;