That's making the assumption that stubbing the InitialContext will solve
all my dependency injection needs.  But if my actionbean has a field in it
that is like:

private PojoWithBusinessLogic bean = new PojoWithBusinessLogic();

Stubbing the InitialContext won't let me DI this bean.


On Mon, Feb 11, 2013 at 12:18 PM, Jocke Eriksson <jockeeriks...@msn.com>wrote:

>  Just mock the initial context factory.
>
>
> see
> http://stackoverflow.com/questions/10045466/how-to-fake-initialcontext-with-default-constructor
> .
>
> ------------------------------
> Date: Mon, 11 Feb 2013 10:18:05 -0800
> From: d...@mirthcorp.com
> To: stripes-users@lists.sourceforge.net
> Subject: [Stripes-users] Using dependency injection on action beans when I
> use MockRoundtrip
>
>
> I read about using the MockRoundtrip here:
> http://www.stripesframework.org/display/stripes/Unit+Testing
>
> The problem I have is a few of my ActionBean's fields are EJBs that get
> populated from the app server.  How can I use dependency injection on the
> action bean's fields?
>
> mockRoundtrip = new MockRoundtrip(context, AnActionBean.class);
> mockRoundtrip.execute("event");  //I don't see a place to use DI
>
> When I call execute here, it gives me a bunch of errors because the EJBs
> couldn't get created.  That's fine, but I don't see a way to implement
> these EJB interfaces as mock classes when I use the MockRoundtrip.
>
> --
> Thanks,
> Dan
>
> CONFIDENTIALITY NOTICE: The information contained in this electronic
> transmission may be confidential. If you are not an intended recipient, be
> aware that any disclosure, copying, distribution or use of the information
> contained in this transmission is prohibited and may be unlawful. If you
> have received this transmission in error, please notify us by email reply
> and then erase it from your computer system.
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall
> before the end March 2013 and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________ Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>


-- 
Thanks,
Dan

-- 
CONFIDENTIALITY NOTICE: The information contained in this electronic 
transmission may be confidential. If you are not an intended recipient, be 
aware that any disclosure, copying, distribution or use of the information 
contained in this transmission is prohibited and may be unlawful. If you 
have received this transmission in error, please notify us by email reply 
and then erase it from your computer system.
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to