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``. .. code-block:: yaml changeAnnotation: addParameter: value: "\"Reason to disable\"" .. code-block:: diff - @Disabled + @Disabled("Reason to disable") void thisTestMethodHasNoDisabledReason(){ Assertions.fail("This test is disabled and should not run"); } .. code-block:: yaml changeAnnotation: addParameter: name: "value" value: "\"my-value\"" .. code-block:: diff - @MyAnnotation(param1 = "") + @MyAnnotation(param1 = "", value = "my-value") private String s; - @MyAnnotation + @MyAnnotation("my-value") private int i; .. code-block:: yaml changeAnnotation: addParameter: - name: "param3" value: 5 - name: "param2" value: "\"\"" .. code-block:: diff - @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. name ^^^^ This options will change the name of the parameter that matches the given name in the ``from`` property. .. code-block:: yaml changeAnnotation: changeParameter: - name: from: "name" to: "myName" .. code-block:: diff - @MyAnnotation(name = "") + @MyAnnotation(myName = "") private String s; value ^^^^^ This options will change the value of the parameter that matches the given name in the ``withName`` property. .. code-block:: yaml changeAnnotation: changeParameter: - value: withName: "name" to: "\"s\"" .. code-block:: diff - @MyAnnotation(name = "") + @MyAnnotation(name = "s") private String s; removeParameter ~~~~~~~~~~~~~~~ Removes the parameter from the annotation that matches the given name in the ``withName`` property. .. code-block:: yaml changeAnnotation: removeParameter: - withName: "name" .. code-block:: diff - @MyAnnotation(name = "") + @MyAnnotation() private String s; .. The anchor below this comment is to link to it from the "whatsnew" page. .. _changeAnnotation_type: type ~~~~ Changes the type of the annotation. .. code-block:: yaml changeAnnotation: changeParameter: - type: "com.example.MyNewAnnotation" .. code-block:: diff - @MyOldAnnotation(name = "s") + @MyNewAnnotation(name = "s") private String s;