Question: This is a graph coverage for source code exercise. Consider the following code: /** * Returns the mininum element in a list * @param list
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 staticsuper 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
