Code File - originalFile.java
private setValueMethod(param1, param2) {
if (param1.getIsMale()) { // Its a boolean
param1.setCity(param2);
} else {
param1.setCity(param1.getOtherCity());
}
}
originalFileTest.java
@Test
public void testSetValueMethod() {
// some previous line setting mock value
when(param1.getIsMale()).then ('.... How to do what i have done in real code file...')
// How to implement if/else in JUnit tests
}
How to implement if/else in JUnits?