今天想寫個單元測試
1. 前提條件
- 開發環境已正確配置
- 工程已解決JUnit依賴關係(pom.xml)
- 我用的是4.12版本:
1 <dependency> 2 <groupId>junit</groupId> 3 <artifactId>junit</artifactId> 4 <version>4.12</version> 5 </dependency>
2. IDEA中JUnit配置
打開Settings窗口搜索junit,如圖(兩個插件都勾選添加):
JUnitGenerator V2.0插件,可以幫助我們自動生成測試代碼。如果搜索juni