Back to schedule page
Prev Next
Quiz Number 2

SWE 637, Fall 2017
18 September
 

Print your name on the line, top right, then answer the questions as concisely as you can. Please write neatly; if I can’t read your answer I have to mark it wrong.

  1. (10 pts.) The following JUnit test method for the computePrimes() method has a non-syntactic flaw. Identify the flaw and describe it in terms of the RIPR model from last week. Be as precise, specific, and concise as you can. For full credit, you must use the terminology introduced in the book.

    In the test method, assume the object has been created properly in an @Before method. You can assume that the getFirstPrime(), getNextPrime(), and the toString() methods have already been tested.

    @Test
    public void testComputePrime()
    {
       p.computePrimes (5); // Compute the first 5 prime numbers
       assertTrue ("computePrimes", p.getFirstPrime().equals (2));
    }