Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get JUnit version

How to know which version of JUnit do I have installed on my PC?

Second question- How do I upgrade it?

like image 819
Pavel Janicek Avatar asked Feb 07 '12 13:02

Pavel Janicek


2 Answers

This will print the version of jUnit.

java -cp <path-to-junit-folder>/junit.jar junit.runner.Version
like image 134
user1799308 Avatar answered Sep 17 '22 21:09

user1799308


The version that you are running depends on the classpath of the running application. It's possible to have multiple versions on the same machine, but if this is in question you can just write a test for it:

import junit.runner.Version;

class SomeTests {

    void testJUnitVersion() {
        assertEquals("4.8.2", Version.id());
    }
}
like image 25
Jay Prall Avatar answered Sep 19 '22 21:09

Jay Prall