AssertJ使用指南:
整理自AssertJ官网
重要概念
- Assertion Generator
自动生成Assert类
- 模板(类,方法)
定义生成的类或方法的格式 - 构建
Generator
- 模板(类,方法)
- Assert类
模板生成或者使用API - 入口类
工厂类,用于产生不同类型的Assert类 - SoftAssert
Using soft assertions, AssertJ collects all assertion errors instead of stopping at the first one.
JUnitSoftAssertions:use in JUnit
-
Assertions provided by AssertJ can be extended by using conditions
- API
UriAssert,ListAssert,DateAssert,MapAssert,Condition
QuickStart
Gradle
testCompile 'org.assertj:assertj-core:2.2.0'