#Unnecessary Stubbing Junit5
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
full code please
@BeforeEach
public void setup(){
when(foo.Enabled()).thenReturn(true)
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
void testFoo(boolean val) {
when(foo.isTopic()).thenReturn(val);
// asserts bar.validate()
}
// bar.validate() method has
if(foo.isTopic() && !foo.isEnabled())
@blissful cairn i don't understand what u mean, can u noobify it?
@split merlin basically bar.validate has an if statement and isTopic() is the first condition
If it evaluates to false
The isEnabled method is not called
I get an unnecessary stubbing error due to that since my parametrized test returns a false topic and Enabled doesnt ever get called
i can only repeat myself
show the full code and the full error message
until then, people are just waiting and wont help