I have a Demoiselle 2.4.2 / JSF / Hibernate application that presents several fully functioning test cases. The BCs operated by these test cases undergo several injections of dependence without any problem. Now I needed the injection of an EJB client, as shown in the code below:
@BusinessController
public class MeuBC implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private SecurityServices securityServices;
@Inject
private TipoVinculoBC tipoVinculoBC;
@EJB(lookup=Constantes.EXTERNAL_SERVICE_JNDI)
private ExternalService EXTERNALService; // <=== Preciso desta injeção!!!
// Restante da classe
}
In the example, we have TipoVinculoBC
being injected without problem. However, during tests only (runs on running the application) ExternalService
is not injected, remaining with null
at runtime, resulting in error.
I stress that is not integration testing , ExternalService
is not in test , it's just a service that MeuBC
depends on any other API), so it is a unit test of MeuBC
.
What is missing so that DemoiselleRunner
or other participant can enable the client injection of ExternalService
?