What does the ECFEntityManager.getEntityManager() do? Btw: You might want to take a look at an already existing Guice-JUnit integration such as Guiceberry or Juckito.
Cheers Alen On Oct 6, 2:50 pm, Luiz Eduardo <[email protected]> wrote: > hi all > i have a RCP application which i'm trying to test with junit and google > guice. > i have a module like this: > > @Override > protected void configure() { > > bind(PapelRepository.class).to(PapelRepostitoryImpl.class).in(Scopes.SINGLE > TON); > > bind(UsuarioRepository.class).to(UsuarioRepositroyImpl.class).in(Scopes.SIN > GLETON) > } > > @Provides > public EntityManager getEntityManger(){ > return ECFEntityManager.getEntityManager(); > } > > and, following some tutorials, i made 2 classes: GuiceIntegration and > GuiceTestRunner > > public class GuiceTestRunner extends BlockJUnit4ClassRunner { > > private final Injector injector; > > /** > * Creates a new GuiceTestRunner. > * > * @param classToRun the test class to run > * @param Guice modules > * @throws InitializationError if the test class is malformed > */ > public GuiceTestRunner(final Class<?> classToRun, Module... > modules) throws InitializationError > { > super(classToRun); > this.injector = Guice.createInjector(modules); > } > > @Override > public Object createTest() > { > return injector.getInstance(getTestClass().getJavaClass()); > } > > @Override > protected void validateZeroArgConstructor(List<Throwable> errors){} > > /** > * Returns the Guice injector. > * > * @return the Guice injector > */ > protected Injector getInjector() > { > return injector; > } > > } > > and > > public class GuiceIntegration extends GuiceTestRunner { > > public GuiceIntegration(Class<?> classToRun) throws > InitializationError { > super(classToRun, new GermantechModule()); > } > > } > > and when i try to run my test, it throws the follwoing error: > > http://pastie.org/2649430 > > as you can see, entitymanager can't be instantiated... > but on my app, the entitymanager and the @Provider runs perfectly. > what am i missing here? -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
