Question: Write one JUnit test class (with assertions, e.g., assertEquals and/or assertTrue) to test the following mid function with concrete test inputs. Please use test fixture,
Write one JUnit test class (with assertions, e.g., assertEquals and/or assertTrue) to test the following mid function with concrete test inputs. Please use test fixture, and mark the corresponding code portions with the following software testing concepts: test case, test fixture, and test oracle. Your tests should be able to cover all the possible program statements within mid. Note that you should not use parameterized tests.
public class TestMe {
public int mid ( int x , int y , int z ) {
int m = z ;
if ( y < z ) {
if ( x < y )
m = y ;
else if ( x < z )
m = x ;
}
else {
if ( x > y )
m = y;
else if (x > z)
m = x
}
return m;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
