Intellij Idea Series guide Jar pack and write unit Test (ii)
I. Original intention
for many beginners, IntelliJ How to import jar package feel very confused, even after searching the relevant articles on the Internet or foggy, this blog through an illustrated way for the reader to clear description, if there are questions please leave a message. Perhaps a lot of Daniel will say, you do not need Maven or gradle to make, how simple, I hereby declare that this article is only for beginners IntelliJ programmer. The author intends to make this blog a series of articles, later on how to use IntelliJ to build maven and Gradle projects.
Two. Import the jar package and write a simple junit
this blog post, created in the Intellij Idea Series Javase Project Creation (i) article, writes a simple junit that demonstrates how to import jar packages in Intellij and how to write unit tests in Intellij.
The author will download the good Junit4.8.2.jar into the F:\libraries path, such as
Create a package in J2SE src, named Add demo1, and then build a class under the pack, called Importjartest.java, please note that the reader "External Libraries" directory currently only "<1.8 > "as shown in
in IntelliJ, select File->project Structure, shortcut key is CTRL + ALT + Shift + S, as
The following screen appears, select "Modules", then click on the "+" indicated in the graph and select "JARS or Directories"
Select the Junit.4.8.2.jar package that has been downloaded in the F:\libraries directory, as shown in the following screen .
Click "OK" to see the section indicated in the red box below, indicating that JUnit's jar package has been added successfully
Click "OK" to observe the Red Line marking section and JUnit's jar package has been added to the project
write the code shown in the Importjartest.java file (readers should not care about the contents of the code)
Select the "Begintest" method in the sample code and right-select "Run begintest ()", as
as shown, JUnit runs successfully
Previous: Intellij idea series of the creation of the Javase project (i)
Intellij Idea Series guide Jar pack and write unit Test (ii)