Question: For each of the following iterations, write just enough code to pass the test... while meeting the principles of TDD. Include the code for each

 For each of the following iterations, write just enough code to
pass the test... while meeting the principles of TDD. Include the code

For each of the following iterations, write just enough code to pass the test... while meeting the principles of TDD. Include the code for each iteration and indicate if it 1) compiles and 2) passes the test Iteration 1 - Example public void testPrimeNumber() { MyNumber n = new MyNumber(); W/You include this after every iteration. import static org.junit. Assert.; import junit. framework. Test Case; import org.junit. public class MyNumber extends Testcase COMPILES AND PASSES (You include this after every iteration.) Iteration 2 I public void testPrimeNumber 0 MyNumber n = new MyNumber(); n.setValue (7); assertEquals(0, s.isPrime()); > Iteration 3 public void testPrimeNumber 0 MyNumber n = new MyNumber(); n.setValue (7); assertEquals(0, n.isPrime()); n.setValue(10): assertEquals(-1, n.isPrime()); 2 Iteration 4 public void testPrime Number 01 My Number n = new MyNumber(); n.setValue (7) assertEquals(0, n.isPrime()); n.setValue (10): assertEquals(-1, n.isPrime()); assertEquals("10 is not Prime", n.printPrime()); 1 Iteration 5 public void testEvenNumbert) MyNumber new MyNumber : n.setValue (3); assertEquals(-1, n.isEven()); n.setValue (2): assertEquals(0, n.isEven()); assertEquals("2 is Even", n.printEven()); Final Step Write a Junit test case for printing the factors of a number, and then write the code to pass the test. The way your code handles the situation is up to you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!