<meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>I don't post much here but I felt obliged to comment on this thread (and my other message awaits for moderation).</div>
<div><br></div>I have to agree with Dan. This probably will be one of the most used injections.<div><br></div><div>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).</div>
<div><br></div><div>If faces context will be injectable it will make many people happy :)</div><div><br></div><div>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.</div>
<div><br></div></span>Best regards,<br>Siarhei Dudzin<br>
<br><br><div class="gmail_quote">On Tue, Nov 10, 2009 at 10:51 PM, Gavin King <span dir="ltr"><<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Call FacesContext.setCurrentInstance() :-)<br>
<div class="im"><br>
On Tue, Nov 10, 2009 at 4:29 PM, Steven Boscarine<br>
<<a href="mailto:steven.boscarine@childrens.harvard.edu">steven.boscarine@childrens.harvard.edu</a>> wrote:<br>
><br>
> Gavin King wrote:<br>
>><br>
>> I didn't put it in, since I figured it was hard to justify that this<br>
>> is better than FacesContext.getCurrentInstance().<br>
>><br>
><br>
> How would one unit test a class that has such a call?<br>
><br>
><br>
><br>
<br>
<br>
<br>
</div><div class="im">--<br>
Gavin King<br>
<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
<a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
<a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
<a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
_______________________________________________<br>
</div><div><div></div><div class="h5">weld-dev mailing list<br>
<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
</div></div></blockquote></div><br>