Kotlinlearncs.online LogoJava
Return to List

Test Writing: Array Count Greater Than (Two Dimensional)

Created By: Geoffrey Challen
/ Version: 2020.6.0

Declare and implement a function called countArrayGreaterThan that receives a two-dimensional array of int values as its first parameter, an int as its second parameter, and returns a count (as an int) of the number of values in the array that are greater than the passed int. If the array is null you should return 0. Note that the array may also be non-rectangular, but no second-level arrays will be null.

Test Design Challenge

You're challenge is to write tests for this problem described above.

  • Provide a method named test that accepts no arguments and does not return a value.
  • If the implementation of the class described above is incorrect, your test method should throw an exception.
  • If it is correct, do not throw an exception.
  • You may want to use Java's assert method