How to select or change JUnit version in Eclipse?

后端 未结 3 1663
别跟我提以往
别跟我提以往 2020-12-20 15:41

Basically the source code I am using requires a very specific JUnit test version such as:

lucene-test-framework-XX.jar
  The compiled Lucene test-framework l         


        
3条回答
  •  独厮守ぢ
    2020-12-20 16:05

    Although the question is how to use a very particular version, the title of the question would also be valid for switching just between JUnit3 and JUnit4. This answer says how to do this.

    Since quite a long time the junit library is part of the eclipse distribution. In eclipse Kepler one can switch between JUnit3 and JUnit4, both covered by the effective JUnit Release 4.11.0 (because JUnit3 is still compatible with JUnit4).

    Right click on your project, select BuildPath/ConfigureBuildPath and select the tab Libraries. Let's suppose there is the library JUnit3 listed and you want to switch to JUnit4. Select the entry JUnit3, then the button "Remove", then "Add library". In the following wizard you choose "JUnit", "next", "JUnit4" in the dropdown and "Finish".

    Maybe you have noticed in the ProjectExplorer that the JUnit4-Library - in contrast to JUnit3 - includes also the hamcrest-core library (which provides powerful matchers).

提交回复
热议问题