Suppose you are asked to test the code below. The code: public String allocateRoom(int numOfEmps) throws IllegalArgumentException {    if (numOfEmps == 0)       throw new IllegalArgumentException();    if (numOfEmps < 5)       return "Small";    if (numOfEmps < 10)       return "Standard"; return "Large"; } Throws exception if there are no employees Returns small up to 5 employees Returns standard for 5 to 9 employees Returns large for 10 or more employees List the minimum amount of test inputs that achieve 100% branch coverage. You need to specify the branch(es) each input covers. List the minimum amount of test inputs that achieve 100% path coverage. You need to specify the path each input covers. Explain if executing the test suites above will reveal any defects.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Suppose you are asked to test the code below. The code:

public String allocateRoom(int numOfEmps) throws IllegalArgumentException {

   if (numOfEmps == 0)

      throw new IllegalArgumentException();

   if (numOfEmps < 5)

      return "Small";

   if (numOfEmps < 10)

      return "Standard"; return "Large";

}

  • Throws exception if there are no employees
  • Returns small up to 5 employees
  • Returns standard for 5 to 9 employees
  • Returns large for 10 or more employees
  1. List the minimum amount of test inputs that achieve 100% branch coverage. You need to specify the branch(es) each input covers.
  2. List the minimum amount of test inputs that achieve 100% path coverage. You need to specify the path each input covers.
  3. Explain if executing the test suites above will reveal any defects.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT