[weld-dev] @Inject FacesContext

Gavin King gavin.king at gmail.com
Tue Nov 10 17:15:16 EST 2009


Guys, it's one of the simplest portable extensions you can possibly write.

Oh and why didn't you speak up six months ago, instead of on the day
we submitted the final draft!

On Tue, Nov 10, 2009 at 5:12 PM, Siarhei Dudzin
<siarhei.dudzin at gmail.com> wrote:
> I don't post much here but I felt obliged to comment on this thread (and my
> other message awaits for moderation).
> I have to agree with Dan. This probably will be one of the most used
> injections.
> The reason for injection is to be able to stub and unit test easily. Right
> now the getCurrentInstance() is static and you'd need to use ugly
> constructions to replace it with a stub (I am not saying it's impossible but
> I am talking here from the feedback I've gathered and personal experience
> when unit testing pure JSF).
> If faces context will be injectable it will make many people happy :)
> Btw, FacesContext.setCurrentInstance() is protected (so you can't just call
> it) which means you'd need to make some 'suboptimal' constructions to make
> it work in unit tests.
> Best regards,
> Siarhei Dudzin
>
>
> On Tue, Nov 10, 2009 at 10:51 PM, Gavin King <gavin.king at gmail.com> wrote:
>>
>> Call FacesContext.setCurrentInstance() :-)
>>
>> On Tue, Nov 10, 2009 at 4:29 PM, Steven Boscarine
>> <steven.boscarine at childrens.harvard.edu> wrote:
>> >
>> > Gavin King wrote:
>> >>
>> >> I didn't put it in, since I figured it was hard to justify that this
>> >> is better than FacesContext.getCurrentInstance().
>> >>
>> >
>> > How would one unit test a class that has such a call?
>> >
>> >
>> >
>>
>>
>>
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list