Question: Task 4 : ImplementWeakClass contains the following methodweakMethod4 public static int weakMethod4(boolean a, boolean b, int c, int d, int e) { int result =
- Task 4: ImplementWeakClass contains the following methodweakMethod4
public static int weakMethod4(boolean a, boolean b, int c, int d, int e) {
int result = 0;
if (a != b) {
if ((c < 0) && (d == 0) || (e > 0)) {
result = 1;
} else {
result = 2;
}
} else {
result = 3;
}
return result;
}
Create two JUnit test classes as follows,where each test case performs a single invocation of weakMethod4.
- WeakClassTestSC4 should achieve 100% statement coverage ofweakMethod4 and contain at most3 test cases.
- WeakClassTestMCDC4 should achieve 100% Modified Condition/Decision Coverage (MC/DC) ofweakMethod4 and contain at most8 test cases.
- Partial credit will NOT be awarded ifWeakClassTestSC4 and WeakClassTestMCDC4 do not satisfy their respective requirements.
- Bonus Points: IfWeakClassTestMCDC4 achieves 100% MC/DC coverage with the minimum possible number of test cases, then you will receive 10 bonus points. Determining the actual minimum is part of the bonus task (but you may safely assume the minimum is less than or equal to 8).
- Both classes should be saved in the directory
/test.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
