MCPcopy
hub / github.com/assertj/assertj

github.com/assertj/assertj @assertj-core-java8-1.0.0m1 sqlite

repository ↗ · DeepWiki ↗ · release assertj-core-java8-1.0.0m1 ↗ · compare 2 versions
11,219 symbols 52,641 edges 1,978 files 3,447 documented · 31%
README

AssertJ - Fluent assertions for java

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

Documentation of all AssertJ projects is maintained on assertj.org, AssertJ Core documentation is here.

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

Build Status

AssertJ's goals

AssertJ's ambition is to provide a rich and intuitive set of strongly-typed assertions to use 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 the Map-specific assertions, which make it easy to check on the contents of the map.

AssertJ is composed of several modules: * A core module (this one) to provide assertions for JDK types (String, Collections, File, Map ...) - see AssertJ Core documentation and javadoc. * A Guava module to provide assertions for Guava types (Multimap,Optional, ...) - see AssertJ Guava documentation and javadoc. * A Joda Time module to provide assertions for Joda Time types (DateTime, LocalDateTime) - see AssertJ Joda Time documentation and javadoc. * A Neo4J module to provide assertions for Neo4J types (Path, Node, Relastionship ...) - see AssertJ Neo4J documentation and javadoc.

Assertion missing? Please create an issue!

AssertJ's assertions are super easy to write: just type assertThat followed by the actual value in parentheses and then a dot, and any Java IDE will show you all the assertions available for the type of the object to verify. No more confusion about the order of the "expected" and "actual" values. Our assertions are very readable as well: they read very close to plain English, making it easier for non-technical people to read test code. A lot of effort have been done to provide intuitive error messages showing as clearly as possible what the problem is.

Note that AssertJ requires at least Java 6.

AssertJ core javadoc is published here.

Latest News

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

Quickstart

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

Assertions for your own 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: * A CLI assertions generator * A Maven plugin assertions generator

Replacing JUnit assertions by AssertJ Assertions

To help you replace JUnit assertions by AssertJ ones, you can use a script or do regexp search and replace manually as indicated 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 contributors section.

Extension points exported contracts — how you extend this code

Vehicle (Interface)
@author Marcus Klimstra (CGI) [10 implementers]
src/test/java/org/assertj/core/test/Vehicle.java
EnumerableAssert (Interface)
Assertions applicable to groups of values that can be enumerated (e.g. arrays, collections or strings.) @param the [12 …
src/main/java/org/assertj/core/api/EnumerableAssert.java
EqualsHashCodeContractTestCase (Interface)
Test case that provides the contract for verification that an object's equals and hashCode are implement
src/test/java/org/assertj/core/test/EqualsHashCodeContractTestCase.java
IndexedObjectEnumerableAssert (Interface)
Assertions methods applicable to indexed groups of objects (e.g. arrays or lists.) @param the "self" type of this as [13 …
src/main/java/org/assertj/core/api/IndexedObjectEnumerableAssert.java
GenericInterface (Interface)
@author Mikhail Mazursky
src/test/java/org/assertj/core/api/GenericInterface.java
ComparableAssert (Interface)
Assertion methods applicable to Comparable s. @param the "self" type of this assertion class. Pl [8 implementers]
src/main/java/org/assertj/core/api/ComparableAssert.java
Doctor (Interface)
(no doc) [1 implementers]
src/test/java/org/assertj/core/util/Doctor.java
ArraySortedAssert (Interface)
Assertions applicable to primitive arrays or arrays of elements either naturally Comparable or according to a gi [10 implementers]
src/main/java/org/assertj/core/api/ArraySortedAssert.java

Core symbols most depended-on inside this repo

failure
called by 1113
src/main/java/org/assertj/core/internal/Failures.java
assertThat
called by 1077
src/main/java/org/assertj/core/api/WithAssertions.java
actualIsNull
called by 570
src/main/java/org/assertj/core/util/FailureMessages.java
newArrayList
called by 510
src/main/java/org/assertj/core/util/Lists.java
isEqualTo
called by 471
src/main/java/org/assertj/core/api/Assert.java
assertContains
called by 364
src/main/java/org/assertj/core/internal/Maps.java
array
called by 358
src/main/java/org/assertj/core/util/Arrays.java
assertDoesNotContain
called by 275
src/main/java/org/assertj/core/internal/Maps.java

Shape

Method 9,201
Class 1,989
Interface 27
Enum 2

Languages

Java100%

Modules by API surface

src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java73 symbols
src/main/java/org/assertj/core/api/AbstractDateAssert.java59 symbols
src/main/java/org/assertj/core/internal/Iterables.java58 symbols
src/main/java/org/assertj/core/internal/Arrays.java56 symbols
src/main/java/org/assertj/core/internal/Dates.java55 symbols
src/main/java/org/assertj/core/internal/Objects.java50 symbols
src/main/java/org/assertj/core/api/AbstractIterableAssert.java50 symbols
src/main/java/org/assertj/core/api/AbstractObjectArrayAssert.java43 symbols
src/main/java/org/assertj/core/api/AbstractAssert.java40 symbols
src/test/java/org/assertj/core/api/BDDAssertions_then_Test.java37 symbols
src/main/java/org/assertj/core/internal/ObjectArrays.java35 symbols
src/main/java/org/assertj/core/internal/Strings.java31 symbols

Dependencies from manifests, versioned

cglib:cglib3.1 · 1×
junit:junit
org.mockito:mockito-core
org.ow2.asm:asm5.0.3 · 1×

For agents

$ claude mcp add assertj \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact