3.2. Passing Method Arguments

To test methods with arguments you need to specify some test argument values to use in your Exemplar:

public int get5() {

    return 5;

@Exemplar(args="2", expect="7")
public int add5(int x) {

    return 5 + x;

@Exemplar(args={"2", "4"}, expect="6")
public int add(int x, int y) {

    return x + y;

The argument values are given as Simple Invocation Notation (SIN) Expressions. These are explained in the next section.

Previous Page   |   Next Page   |   Table of Contents

Comments are closed.