Something is missing

Report a typo

Suppose we have a Calculator class with the following method:

public int sum(Collection<Integer> numbers) {
    if (numbers == null) {
        return 0;
    }

    int sum = 0;
    for (int number : numbers) {
        sum += number;
    }
    return sum;
}

We also have a test method for the test case where the argument of the sum method is null:

@Test
void testSum() {
    Calculator calculator = new Calculator();
    Collection<Integer> collection = null;
    // TODO implement
}

Complete the missing line of code with an assertion method to be sure that sum returns the correct result for the provided argument.

Enter a short text
___

Create a free account to access the full topic