3.10. Further Documenting your Exemplars

There are some additional properties to further document your Exemplars:

3.10.1. Setting description

Use the description property if you want to describe an Exemplar. The description is used in markers for that Exemplar. This is useful if you to describe the behaviour or rule that each Exemplar is enforcing.

3.10.2. Setting debug

Sometimes it is useful to test SIN expressions for syntactic correctness and to ensure they’re doing what you want. The debug property allows you to specify a SIN Expression which will be executed on the Exemplar, and the result given in a Sureassert marker against the Exemplar.

@Exemplar(args="m:'key1'=[l:1,2,3],'key2'=[l:4,5,6]", expect="$arg1.get('key2').get(2).equals(7)", debug="$arg1")
public static void incrementAll(Map<String, List<Integer>> map) {

    for (List<Integer> intList : map.values()) {
        for (int i = 0; i < intList.size(); i++) {
            intList.set(i, intList.get(i) + 1);
        }
    }
}

This example adds the Sureassert marker:

- Exemplar invocation of debug expression $arg1 returned [m:'key1'=[l:2,3,4],'key2'=[l:5,6,7]]

Note for detailed debugging, you can add breakpoints and run Exemplars in a separate process using the Eclipse debugger (Debug As-> Sureassert UC). See the Debugging Exemplars and JUnits section for details.

Previous Page   |   Next Page   |   Table of Contents

Comments are closed.