0

I was wondering if "for" loop coverage can be applied to "for each" loops as well.. If so, how can it be done on the following code sample?

1. public static void foreachDisplay(int[] data){
  2. System.out.println("Display an array using for 
  3. each loop");
  4. for (int a  : data) {
    5. System.out.print(a+ " ");
    6. }
  7. }

Thank you.

Engineering Mind
  • 113
  • 3
  • 12

1 Answers1

0

You should test this at least twice, once with an empty array and the second with a few elements in the array. You could also test it with exactly 1 element in the array, if you want to count that as the boundary value.

user1054999
  • 111
  • 3