I have a service with a method that includes a local variable (cliente), a pojo, not a bean, and I would like to mock a method of that object (consultaDatos( ... )) in a test. So the code of my service is like this:
@Service
public class ServicioFn {
...
public RespuestaConsultaFamiliaNumerosa obtenerDatosFamiliaNumerosa( ... ) {
Cliente cliente = ...;
return cliente.consultaDatos( ... );
}
}
As cliente is not a bean, @MockBean in my test (it's a @SpringBootTest) doesn't work. How could I mock that object?