Skip to content

AssertJ is a library providing easy to use rich typed assertions

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE.md
Unknown
licence-header.txt
Notifications You must be signed in to change notification settings

gsheasby/assertj-core

 
 

AssertJ - Fluent assertions for java

master: Build Status (master) 2.x: Build Status (2.x) Maven Central

AssertJ provides a rich and intuitive set of strongly-typed assertions to use for unit testing (with JUnit, TestNG or any other test framework).

The AssertJ web site contains all projects documentation and can be found here. It notably includes the AssertJ Core documentation.

You can ask questions in stackoverflow (assertj tag) and make suggestions by simply creating an issue.

AssertJ's ambition is to provide a rich and intuitive set of strongly-typed assertions for unit testing.

The idea is that disposal assertions should be specific to the type of the objects we are checking when writing unit tests. If you're checking the value of a String, you use String-specific assertions. Checking the value of a Map? Use Map-specific assertions to easily check the contents of the map.

AssertJ is composed of several modules:

Assertion missing? Please create an issue!

AssertJ's assertions are super easy to use: just type assertThat followed by the actual value in parentheses and a dot, then any Java IDE will show you all assertions available for the type of the object. No more confusion about the order of "expected" and "actual" value.

AssertJ's assertions are very close to plain English.

A lot of effort has been spent to provide intuitive failure messages showing clearly why the assertion failed.

Note that AssertJ 3.x requires at least Java 8 and AssertJ 2.x requires at least Java 7.

It is easy to start using AssertJ, just follow the one minute starting guide.

To read details on the latest releases, please go to AssertJ Core latest news.

Having assertions for common types like List is great, but you might want some assertions specific to your own types. It is simple to write assertions for your custom types with AssertJ because it is easily extensible.

Moreover, to ease your work, we provide assertions generator that can take a set of custom types and create specific assertions. The tools provided are:

To help you replace JUnit assertions with AssertJ ones, you can use a script or do regexp search and replace manually as described here.

Check our migration guide, it covers migrating from Fest 1.4 and migrating from Fest 2.x.

You are encouraged to contribute any missing, useful assertions. To do so, please read the contributing section.

About

AssertJ is a library providing easy to use rich typed assertions

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE.md
Unknown
licence-header.txt

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.7%
  • Shell 0.3%