I am stuck in a situation where I am not able to fix the 1 of 6 branches issue. Below is the small code I tried to produce
package org.example;
public class Testing {
public static final String ONE = "1";
public static boolean condition(String x, boolean y, String z) {
return "ABC".equalsIgnoreCase(x)
&& (y || ONE.equals(z));
}
}
Test case:
package org.example;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class BranchCoverageTest {
@Test
public void testCondition_xIsABC_yTrue_zNotEqualOne() {
// Testing the case where the first branch is true, but the second branch is false
// "ABC".equalsIgnoreCase("ABC") is true, but (true || "1".equals("1")) is true
assertTrue(Testing.condition("ABC", true, "1"));
}
@Test
public void testCondition_xIsNotABC_yFalse_zEqualsOne() {
// Testing the case where the first branch is false, but the second branch is true
// "ABC".equalsIgnoreCase("DEF") is false, but (false || "1".equals("1")) is true
assertFalse(Testing.condition("DEF", false, "1"));
}
@Test
public void testCondition_xIsNotABC_yFalse_zNotEqualOne() {
// Testing the case where both branches are false
// "ABC".equalsIgnoreCase("DEF") is false, and (false || "1".equals("XYZ")) is false
assertFalse(Testing.condition("DEF", false, "XYZ"));
}
@Test
public void testCondition_xIsABC_yFalse_zNotEqualOne() {
// Testing the case where the first branch is true, but the second branch is false
// "ABC".equalsIgnoreCase("ABC") is true, and (false || "1".equals("XYZ")) is false
assertFalse(Testing.condition("ABC", false, "XYZ"));
}
}

2*2*2) combinations to be tested... I see 4 - considering the first element being"ABC", we got 4 cases to test; only 2 are being tested || ¹ not counting upper/lower-case alternatives (first parameter)&&and||can short-cut.add(1, 2) == 3it could be implemented asint add(int x, int y) { return 1 + 2; }(intentional absurd example - and I am well aware that often it is not possible/feasible to test all combinations)