On Mon, 2006-01-16 at 07:55 +0100, Mario Ivankovits wrote:
> Hi!
> > And it works for me too.
> >
> > On Sun, 2006-01-15 at 22:28 +0100, Arvid Hülsebus wrote:
> >
> >> I just updated the sources and run a 'mvn clean install' and everything
> >> worked out fine. The tests didn't fail.
> All this is odd. I tried it now on another machine and got the same test
> failure.
> I also tried a completely new checkout.
>
> But now I know whats the problem is: The mock tests were trained to see
> a getValue(null) but instead the component issued a
> getValue(instance-of-mock-context).
> The following patch fixed it for me:
>
> Index:
> /home/im/projects/myfaces/api/api/src/test/java/javax/faces/component/UIComponentBaseTest.java
> ===================================================================
> ---
> /home/im/projects/myfaces/api/api/src/test/java/javax/faces/component/UIComponentBaseTest.java
>
> (revision 369368)
> +++
> /home/im/projects/myfaces/api/api/src/test/java/javax/faces/component/UIComponentBaseTest.java
>
> (working copy)
> @@ -62,7 +62,7 @@
> public void testIsRenderedBinding() {
> MockControl bindingControl =
> MockClassControl.createControl(ValueBinding.class);
> ValueBinding mockBinding = (ValueBinding)bindingControl.getMock();
> - mockBinding.getValue(null);
> + mockBinding.getValue(FacesContext.getCurrentInstance());
Well, the code I've got has
mockBinding.getValue(null);
and it is definitely working fine.
I tried your patch, and that works too - because
FacesContext.getCurrentInstance()
is returning null. Putting
assertNotNull(FacesContext.getCurrentInstance());
in the testIsRenderedBinding method causes test failure.
So clearly for you there is a faces context at this point, while for
myself (and Arvid) there isn't. Weird.
Because the facesContext is in fact a thread-local variable I guess it's
possible that some other test is setting one up, and not clearing it in
the test's teardown method. Do you perhaps have some other tests you've
written which have not been checked in and which might have this
side-effect, and which are run before this test?
Regards,
Simon