You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2014/08/28 17:36:50 UTC

Re: git commit: workwaround to fix unit tests as Hamcrest's IsCollectionContaining seems buggy

On 2014-08-28, <jl...@apache.org> wrote:

> workwaround to fix unit tests as Hamcrest's IsCollectionContaining seems buggy

actually, it is Hamcrest's isA matcher that is borked, stumbled over it
myself a few times.

> -        assertThat(project.getBuildListeners(), hasItem(isA(MultiModuleLogger.class)));

here isA(MultiModuleLogger.class) is a Matcher<MultiModuleLogger> rather
than a Matcher<?> or Matcher<Object>, this is pretty much useless.

In your case hasItem wants a Matcher<? super BuildListener> and
MultiModuleLogger is not a lower bound of BuildListener.

https://github.com/hamcrest/JavaHamcrest/issues/27

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: git commit: workwaround to fix unit tests as Hamcrest's IsCollectionContaining seems buggy

Posted by Jean-Louis Boudart <je...@gmail.com>.
Thanks for the feedback Stefan :)


2014-08-28 17:40 GMT+02:00 Stefan Bodewig <bo...@apache.org>:

> On 2014-08-28, Stefan Bodewig wrote:
>
> > On 2014-08-28, <jl...@apache.org> wrote:
>
> >> workwaround to fix unit tests as Hamcrest's IsCollectionContaining
> seems buggy
>
> > actually, it is Hamcrest's isA matcher that is borked, stumbled over it
> > myself a few times.
>
> and you can use
>
> new org.hamcrest.core.IsInstanceOf(MultiModuleLogger.class)
>
> as an alternative (which works, while the instanceOf factory method has
> the same problem as the isA matcher).
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>


-- 
Jean Louis Boudart
Independent consultant
Apache EasyAnt commiter http://ant.apache.org/easyant/

Re: git commit: workwaround to fix unit tests as Hamcrest's IsCollectionContaining seems buggy

Posted by Stefan Bodewig <bo...@apache.org>.
On 2014-08-28, Stefan Bodewig wrote:

> On 2014-08-28, <jl...@apache.org> wrote:

>> workwaround to fix unit tests as Hamcrest's IsCollectionContaining seems buggy

> actually, it is Hamcrest's isA matcher that is borked, stumbled over it
> myself a few times.

and you can use

new org.hamcrest.core.IsInstanceOf(MultiModuleLogger.class)

as an alternative (which works, while the instanceOf factory method has
the same problem as the isA matcher).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org