assertj
AssertJ is a Java testing library that provides fluent, type-specific assertions for unit tests. It allows developers to write readable test conditions using method chaining and IDE code completion, supporting JDK types, Guava, Joda Time, Neo4J, databases, and Swing UI testing.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | assertj/assertj |
| Owner | assertj |
| Primary language | Java |
| License | Apache-2.0 — OSI-approved |
| Stars | 2.8k |
| Forks | 780 |
| Open issues | 256 |
| Latest release | assertj-build-3.27.7 (2026-01-24) |
| Last updated | 2026-07-07 |
| Source | https://github.com/assertj/assertj |
What assertj is
AssertJ is a modular assertion framework for JVM languages (Java, Kotlin, Groovy) offering strongly-typed assertions with fluent API design. Core module covers JDK collections, strings, streams, and files; additional modules extend support to Guava, temporal types, graph databases, relational databases, and UI frameworks.
Get the assertj source
Clone the repository and explore it locally.
git clone https://github.com/assertj/assertj.gitcd assertj# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- AssertJ requires strong typing; generic wildcards and complex type hierarchies can complicate assertion chains—test IDE autocomplete before wide adoption.
- Module interdependencies: Guava, Joda Time, and DB modules are separate downloads; ensure Maven/Gradle pulls correct transitive dependencies.
- Custom assertions can be generated (extension framework exists); factor in learning curve for teams creating domain-specific assertion classes.
- Performance: fluent API creates intermediate objects; negligible for unit tests, but avoid in tight loops or performance-critical test suites.
- API surface is large; code reviews should enforce consistent assertion patterns to avoid test code becoming brittle or over-specific.
When to avoid it — and what to weigh
- Non-JVM Languages — AssertJ is Java/JVM-native. Not suitable for Python, JavaScript, Go, or other language ecosystems; each has idiomatic assertion libraries.
- Property-Based Testing Requirements — AssertJ is example-based; it lacks built-in property-based testing (generative testing). Consider QuickCheck-style frameworks if that is a core need.
- Behavioral/BDD-Style Test Narratives — AssertJ focuses on assertions, not full Given-When-Then narrative frameworks. Use Cucumber or Spock if BDD story structure is mandatory.
- Very Low Java Version Support — If locked to Java 7 or earlier, AssertJ may not be compatible. Check minimum version requirements against your target platform.
License & commercial use
Licensed under Apache License 2.0 (SPDX: Apache-2.0), a permissive OSI-approved license allowing commercial use, modification, and distribution with minimal restrictions (retain license/copyright notices, state changes).
Apache-2.0 permits commercial use without additional licensing fees or restrictions. Can be bundled in proprietary software. Requires retaining license notices in distribution. No warranty or liability guarantees; as-is software.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
AssertJ is a test library with no network I/O, cryptography, or authentication scope. Security risk surface is minimal. Use standard dependency scanning (Snyk, Dependabot) to monitor for transitive vulnerabilities in rare cases. No secrets or sensitive data should appear in assertion logs.
Alternatives to consider
Hamcrest
Older matcher-based library; less fluent, heavier syntax. Hamcrest is lighter weight but AssertJ's type-specific assertions are more discoverable via IDE.
Truth (Google)
Modern fluent assertion library similar to AssertJ. Smaller ecosystem; fewer domain-specific modules. AssertJ has broader JVM language support and longer adoption track record.
Kotest/Kluent
Kotlin-native assertion DSLs. Ideal if Kotlin is primary language. AssertJ works cross-JVM but KotlinTest syntax is more idiomatic for Kotlin projects.
Build on assertj with DEV.co software developers
Explore AssertJ documentation, check Maven Central for the latest version, and consider whether domain-specific modules (DB, Guava, Neo4J) fit your testing strategy.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
assertj FAQ
Can I use AssertJ with TestNG or Spock instead of JUnit?
Do I need all modules or just core?
Is AssertJ thread-safe for concurrent test execution?
What is the performance overhead of fluent assertions?
Software development & web development with DEV.co
From first prototype to production, DEV.co delivers software development services around tools like assertj. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source testing and beyond.
Ready to improve your test assertions?
Explore AssertJ documentation, check Maven Central for the latest version, and consider whether domain-specific modules (DB, Guava, Neo4J) fit your testing strategy.