Giter Club home page Giter Club logo

assertj-core's Introduction

AssertJ - Fluent assertions for java

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

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

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

You can ask questions and make suggestions on AssertJ google group.

AssertJ's goals

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

The idea is that, when writing unit tests, we should have at our disposal assertions specific to the type of the objects we are checking. If you're checking the value of a String, you use String-specific assertions. Checking the value of a Map? Use Map-specific assertions, which makes it easy to 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 read 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.

Quickstart

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

Latest News

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

Assertions for custom types

Having assertions for common types like List is great, but you might want some that are specific to your own types. This is possible with AssertJ because it is easily extensible so it's simple to write assertions for your custom types.

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:

Replacing JUnit assertions with AssertJ Assertions

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

Migrating from FEST Assertions

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

Want to contribute?

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

assertj-core's People

Contributors

abalhier avatar alexbischof avatar alexruiz avatar ash2k avatar brianlaframboise avatar chriscancompute avatar dancorder avatar epeee avatar fiery-phoenix avatar filiphr avatar gesellix avatar glhez avatar hazendaz avatar jcgay avatar joel-costigliola avatar kamilszymanski avatar lpandzic avatar marcus-nl avatar mariuszs avatar mhaligowski avatar mikosik avatar mkordas avatar nfrancois avatar olim7t avatar olivierdemeijer avatar pascalschumacher avatar pimterry avatar turbo87 avatar twillouer avatar wanghy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.