The following JUnit test method purports to test the add() method from BasicCollection. Assume the setUp() method from BasicCollectionTester is used. Are there problems?
```
public void testAdd() {
assertTrue( c.isEmpty() );
assertTrue ( c.contains(“B”) );
assertTrue ( c.contains(“C “) );
assertTrue ( c.contains(“A”) );
assertEquals( c.contains(“Missing”), false );
}
```
The first test will not pass because there are 3 elements in the collection from the setup() method in BasicCollectionTester. Therefore, the testAdd() method is not relevant to evaluate the correctness of add(). Removing the first assertTrue(), we will be able to use the testAdd() method as intended.
You might also like to view...
Which answer below is the final step in the formal acceptance activity for an ICT product?
A. Extensive testing B. Quality assurance C. Closure D. Performance review
Suppose we are given an STL vector container named vec that holds values of type double. What do each of vec[0], vec.front(), *(vec.begin()), *(vec.end() – vec.size())and *(vec.rend()-1) mean?
What will be an ideal response?
________ are raw facts
A) Objects B) Data C) Queries D) Information
To help add interactivity to your buttons, Flash uses a(n) ____________________ language to interpret and execute user actions.
Fill in the blank(s) with the appropriate word(s).