Question: The following method is an example of a test method, similar to ones that you will write for your programming assignments this semester. The test

The following method is an example of a test method, similar to ones that you will write for your programming assignments this semester. The test method defines three scenarios. It should return true if and only if ALL the test scenarios pass, and false if ANY of the test scenarios fail.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* Tests two input/output combinations for the example method
* @return true if and only if both tests pass
*/
public static boolean testExampleMethod(){
// first test scenario: input 1
String expected = "foo";
if (!exampleMethod(1).equals(expected)){
return false;
}
/* LINE 12*/
// second test scenario: input 2
expected = "bar";
if (!exampleMethod(2).equals(expected)){
return false;
}
/* LINE 20*/
// third test scenario: input 3
expected = "zoo";
if (!exampleMethod(3).equals(expected)){
return false;
}
/* LINE 28*/
}
At which line should the statement return true; be placed to CORRECTLY implement the above testExampleMethod() tester method?

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!