Re: [junit] Latest JUnit 4.7 snapshot, includes Hamcrest 1.2

Stefan Bodewig <[email protected]> Fri, 05 Jun 2009 13:13:54 +0200
Newsgroups gmane.comp.java.junit.devel,gmane.comp.java.junit.user
Message-ID <[email protected]>
On 2009-06-03, David Saff <[email protected]> wrote:

> Stefan,

> Logged here:

> http://github.com/KentBeck/junit/issues#issue/9

> I think I may have a solution, by following hamcrest's lead and
> changing the signature of assertThat.  I'll release another snapshot
> soon you can try.

The snapshot still didn't do the trick and I think it is Hamcrest's
Is.is(Class<T>) method.  The signature changed from

                Matcher<Object> is(java.lang.Class<?>)

to

                <T> Matcher<? super T> is(Class<T>) 

I've changed XMLUnit's tests to use IsInstanceOf.instanceOf()
explicitly instead of using the is() method and things compile and
work correctly with both JUnit 4.6 and the 20090604 snapshot.

Note that instanceOf also changed from

                Matcher<Object> instanceOf(Class<?>)

to

                <T> Matcher<T> instanceOf(Class<?>)

but it works (note it is still Class<?> in Hamcrest 1.2).

BTW, if I compile the older test code using is() (XMLUnit svn trunk
revision 342)
<http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/xmlunit/>
against 4.6 and run them with the latests JUnit snapshot things work
just fine - it's just the code doesn't compile using the snapshot.

Stefan

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get