<meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>I don&#39;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&#39;d need to use ugly constructions to replace it with a stub (I am not saying it&#39;s impossible but I am talking here from the feedback I&#39;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&#39;t just call it) which means you&#39;d need to make some &#39;suboptimal&#39; 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">&lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt;</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>
&lt;<a href="mailto:steven.boscarine@childrens.harvard.edu">steven.boscarine@childrens.harvard.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; Gavin King wrote:<br>
&gt;&gt;<br>
&gt;&gt; I didn&#39;t put it in, since I figured it was hard to justify that this<br>
&gt;&gt; is better than FacesContext.getCurrentInstance().<br>
&gt;&gt;<br>
&gt;<br>
&gt; How would one unit test a class that has such a call?<br>
&gt;<br>
&gt;<br>
&gt;<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>