Please help in writing Junit for the interface default method.
public interface ABC {
default List getSrc(DEF def, XYZ xyz) t
You can either create a class that implements your interface or make your test implement it. The second one seems to be a shorter solution:
public class FunctionCallingTransactionTemplateTest implements FunctionCallingTransactionTemplate {
private final Object object = Mockito.mock(Object.class);
@Test
public void should_invoke_function() throws Exception {
// given
when(object.toString()).thenReturn("salami");
// when
String result = functionCallingTransactionTemplate().execute((status) -> object.toString());
// then
assertThat(result).isEqualTo("salami");
}
}