Question
computePrimes() has a fault that causes it not to include prime numbers whose last digit is 9. For example, it omits 19, 29, 59, 79,
computePrimes() has a fault that causes it not to include prime numbers whose last digit is 9. For example, it omits 19, 29, 59, 79, 89, 109, ...
Answer the following questions a through f, if the test could be created describe what the test case would be or explain why it cannot be created:
- A test that does not reach the fault
b. A test that reaches the fault, but does not infect
c. A test that infects the state, but does not propagate
d. A test that propagates, but does not reveal
e. Write a Junit test that reveals the fault for the following input.
computePrimes(8);
Expected = [2, 3, 5, 7, 11, 13, 17, 19]
Result = [2, 3, 5, 7, 11, 13, 17, 23]
f. After repairing the fault, write a data-driven Junit test for the toString method with at least 3 different values. In particular, this data-driven test method should test toString method using @ParameterizedTest based on the results of computePrimes method for n = 7, 8 and 9.
public class PrimeNumbers implements IterableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started