deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deven Phillips <deven.phill...@gmail.com>
Subject Re: Jetty/WebSockets With DeltaSpike
Date Fri, 14 Nov 2014 15:30:48 GMT
So, to get to the real meat of the matter: IF I use BeanProvider to inject
an instance, how would I mock that instance in my unit tests?

For example:

AbstractSocketHandler handlerInstance =
> BeanProvider.injectFields(HandlerImpl.class.newInstance());


How would I mock that instance so that I can properly unit test without
having to build lots of crazy things?

Thanks again!!

Deven

On Fri, Nov 14, 2014 at 9:47 AM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> hi deven,
>
> it depends on details you haven't provided.
> however, in any case you can use BeanProvider#injectFields to fill
> injection points of any instance which isn't managed by the cdi-container.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache
> MyFaces, DeltaSpike and OpenWebBeans
>
>
>
> 2014-11-14 15:32 GMT+01:00 Deven Phillips <deven.phillips@gmail.com>:
>
> > Hi all,
> >
> >      New to DeltaSpike (coming from Guice) and I am trying to migrate my
> > Jetty websocket implementation to DeltaSpike, but I would like some help
> > figuring out how to properly inject my JSR-356 annotated object into the
> > WebSocketCreator class. I have created an abstract AbstractSocketHandler
> > which both of my implementation inherit from. So, in my project, if I
> have
> > a class which @Produces an instance of that, does anyone know if the
> Jetty
> > implementation will inject it into the appropriate places? Or will I have
> > to manually use BeanManager to accomplish the injections?
> >
> > Thanks in advance for any help!!
> >
> > Deven Phillips
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message