write a method calledflawedMethod1 that contains a division by zero fault such that (1) it is possible
Fantastic news! We've Found the answer you've been seeking!
Question:
- write a method calledflawedMethod1 that contains adivision by zero fault such that (1) it is possible to create a test suite that achieves 100% branch coverage and doesnot reveal the fault, (2) any test suite that achieves 100% path coverage reveals the fault (and there must exist at least one such test suite).
The method can have any signature.
If such a method is possible, then it can be written with simple code.
- If you think it is not possible to create a method meeting both requirements, then:
- Create an empty method.
- Add a comment in the (empty) body of the method thatconcisely but convincingly explains why creating such a method is not possible.
- Conversely, if you were able to create the method, create two JUnit test classes as follows:
- FlawedClassTestBC1 should achieve 100% branch coverage offlawedMethod1 andnot reveal the fault therein.
- FlawedClassTestPC1 should achieve 100% path coverage offlawedMethod1 and reveal the fault therein.
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date: