SWE 437 In Class Exercise # 19
Graph Coverage for Source Code


Names:
Instructions: Work with your neighbors in groups. This is a graph coverage for source code exercise. Consider the following code:
/**
   * Returns the mininum element in a list
   * @param list Comparable list of elements to search
   * @return the minimum element in the list
   * @throws NullPointerException if list is null or
   *         if any list elements are null
   * @throws ClassCastException if list elements are not mutually comparable
   * @throws IllegalArgumentException if list is empty
   */
   public static <T extends Comparable<? super T>> T min (List<? extends T> list) {
       Iterator<? extends T> itr = list.iterator();
       if (itr.hasNext() == false) {
          throw new IllegalArgumentException("min: Empty list");
       }

       T result = itr.next();
       if (result == null) throw new NullPointerException("Min.min");

       while (itr.hasNext()) {
           T comp = itr.next();
           if (comp.compareTo(result) < 0) {    // throws NPE, CCE as needed
               result = comp;
           }
       }
       return result;
    }

Develop a control flow graph model of the code.

Obtain test requirements from the graph model: node, edge, edge pair, prime-path.

Develop tests (including expected outputs) that satisfy the test requirements.