RE: Test for JUnit version?

Roger Whitcomb <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <MWHPR06MB3310C2D3DDD8C48009CFCFADE7AA0@MWHPR06MB3310.namprd06.prod.outlook.com>
Perfect!  Somehow missed that ... :)  Thank you.

-----Original Message-----
From: Stefan Bodewig [mailto:[email protected]] 
Sent: Thursday, July 06, 2017 8:58 PM
To: [email protected]
Subject: Re: Test for JUnit version?

On 2017-07-06, Roger Whitcomb wrote:

> Hi all,
>                 I just realized I have written some JUnit tests that rely on "assertNotEquals" that has just appeared "recently" in JUnit (as in, 4.11 and 4.12, but not 4.10).  I'm testing for the presence of JUnit in the classpath in my "build.xml", but is there a way to test for the specific version of JUnit?  I see there is a "org.junit.runner.JUnitCore.getVersion()" method, which presumably could be used, but I'm guessing I'd have to write Javascript in my "build.xml" in order to test that.
>                 Anyone have a better idea?

You can use a <condition> together with <hasmethod> [1] to directly test for the presence of assertNotEquals.

Stefan

[1] http://ant.apache.org/manual/Tasks/conditions.html#hasmethod

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.