You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
This section describes the assertions provided by AssertJ Core and other useful features to get the best of it.
5
5
6
-
AssertJ Core http://www.javadoc.io/doc/org.assertj/assertj-core/[Javadoc] explains each assertion, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
6
+
AssertJ Core {assertj-core-javadoc}[Javadoc] explains each assertion, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
This section describes the assertions common to all types, the Javadoc for common assertions methods is available https://www.javadoc.io/static/org.assertj/assertj-core/{assertj-version}/org/assertj/core/api/AbstractAssert.html#method.summary[here].
761
+
This section describes the assertions common to all types, the Javadoc for common assertions methods is available {assertj-core-javadoc}/org/assertj/core/api/AbstractAssert.html#method.summary[here].
762
762
763
763
[[assertj-core-object-assertions]]
764
764
==== Object assertions
765
765
766
-
The Javadoc for `Object` assertions is available https://www.javadoc.io/static/org.assertj/assertj-core/{assertj-version}/org/assertj/core/api/AbstractObjectAssert.html#method.summary[here].
766
+
The Javadoc for `Object` assertions is available {assertj-core-javadoc}/org/assertj/core/api/AbstractObjectAssert.html#method.summary[here].
767
767
768
768
[[assertj-string-object-assertions]]
769
769
==== String/CharSequence assertions
770
770
771
771
This section describes all the available assertions for `CharSequence` (including `String`, `StringBuilder`, `StringBuffer`, ...):
772
772
773
-
The Javadoc for `CharSequence` assertions is available https://www.javadoc.io/static/org.assertj/assertj-core/{assertj-version}/org/assertj/core/api/AbstractCharSequenceAssert.html#method.summary[here].
773
+
The Javadoc for `CharSequence` assertions is available {assertj-core-javadoc}/org/assertj/core/api/AbstractCharSequenceAssert.html#method.summary[here].
774
774
775
775
776
776
[[assertj-core-group-assertions]]
@@ -781,8 +781,8 @@ The Javadoc for `CharSequence` assertions is available https://www.javadoc.io/st
|Verifies that the actual group contains only the given values and nothing else in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found)
|Verifies that the actual iterable/array contains at least one of the given values (like an `or` operator on the given values)
828
828
829
829
|===
@@ -954,7 +954,7 @@ Filtering is handy to target assertions on some specific elements, the filter cr
954
954
* an element link:#filtering-elements-matching-given-assertions[matching some assertions]
955
955
* an element matching a link:#filtering-with-a-condition[Condition]
956
956
957
-
Let's explore these options in some examples taken from {assertj-examples-repo}/tree/main/assertions-examples/src/test/java/org/assertj/examples/FilterExamples.java#L47[FilterExamples] from the {assertj-examples-repo}[assertions-examples] project.
957
+
Let's explore these options in some examples taken from {assertj-examples-github}/tree/main/assertions-examples/src/test/java/org/assertj/examples/FilterExamples.java#L47[FilterExamples] from the {assertj-examples-github}[assertions-examples] project.
You can extract several values from the elements under test and check them using {assertj-core-javadoc-root}org/assertj/core/api/Assertions.html#tuple(java.lang.Object...)[tuples].
1151
+
You can extract several values from the elements under test and check them using {assertj-core-javadoc}/org/assertj/core/api/Assertions.html#tuple(java.lang.Object...)[tuples].
1152
1152
1153
1153
As an example, let's check the name, age and race's name of each TolkienCharacter element:
The extracted name, age and race's name values of the current element are grouped in a tuple, thus you need to use tuples for specifying the expected values.
1176
1176
1177
-
More examples are available in link:{assertj-examples-base-package}IterableAssertionsExamples.java#L210[IterableAssertionsExamples.java] of the link:{assertj-examples-repo}[assertj-examples] project.
1177
+
More examples are available in link:{assertj-examples-base-package}/IterableAssertionsExamples.java#L210[IterableAssertionsExamples.java] of the link:{assertj-examples-github}[assertj-examples] project.
1178
1178
1179
1179
[[group-flat-extracting]]
1180
1180
====== Extracting and flattening multiple values per element
@@ -1248,7 +1248,7 @@ This chapter answers the question: how to assert that an exception has been thro
1248
1248
[[assertj-core-exception-assertions-reference]]
1249
1249
===== Reference
1250
1250
1251
-
All the available assertions are described in the link:{assertj-core-javadoc-root}org/assertj/core/api/AbstractThrowableAssert.html#method.summary[AbstractThrowableAssert javadoc].
1251
+
All the available assertions are described in the link:{assertj-core-javadoc}/org/assertj/core/api/AbstractThrowableAssert.html#method.summary[`AbstractThrowableAssert` Javadoc].
1252
1252
1253
1253
In this chapter the term `exception` is used interchangeably with `throwable`.
1254
1254
@@ -1269,7 +1269,7 @@ If you use java 7, check the link:#assertj-core-exception-assertions-java-7[Java
1269
1269
1270
1270
There are various ways for checking the exception message content, you can check the exact message, what it contains, its start, its end, if it matches a regex.
1271
1271
1272
-
Most of the assertions expecting a `String` can use the https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true#format-java.lang.String-java.lang.Object...-[String.format] syntax.
1272
+
Most of the assertions expecting a `String` can use the https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true#format-java.lang.String-java.lang.Object\...-[String.format] syntax.
http://www.javadoc.io/doc/org.assertj/assertj-core/ is the latest version of AssertJ Core Javadoc, each assertion is explained, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
2753
+
{assertj-core-javadoc} is the latest version of AssertJ Core Javadoc, each assertion is explained, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
Copy file name to clipboardExpand all lines: src/docs/asciidoc/user-guide/assertj-core-extension.adoc
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ AssertJ can be extends by Condition or writing your own assertions class.
6
6
[[assertj-core-conditions]]
7
7
==== Conditions
8
8
9
-
Assertions can be extended by using conditions, to create a condition you just have to implement https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/Condition.html[`org.assertj.assertions.core.Condition`] and its unique method matches.
9
+
Assertions can be extended by using conditions, to create a condition you just have to implement {assertj-core-javadoc}/org/assertj/core/api/Condition.html[`org.assertj.assertions.core.Condition`] and its unique method matches.
10
10
11
11
Once your Condition is created, you can use it with methods: `is(myCondition)` or `has(myCondition)`, both verifying that the condition is met (hint: pick the one that makes your code more readable).
12
12
@@ -32,7 +32,7 @@ You can verify that a Condition is met on elements of a collection, with the fol
32
32
33
33
Moreover all Condition related methods have their negation counterpart, `is`/`isNot`, `have`/`doesNotHave`, `are`/`areNot`, ...
34
34
35
-
The examples below are from https://github.com/assertj/assertj-examples/[assertj-examples] and more specifically https://github.com/assertj/assertj-examples/blob/main/assertions-examples/src/test/java/org/assertj/examples/condition/UsingConditionExamples.java[UsingConditionExamples.java].
35
+
The examples below are from {assertj-examples-github}[assertj-examples] and more specifically {assertj-examples-base-package}/condition/UsingConditionExamples.java[`UsingConditionExamples`].
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
118
+
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
119
119
----
120
120
121
121
We can write these assertions:
@@ -147,7 +147,7 @@ Sections:
147
147
148
148
Let's see how to do that with an example!
149
149
150
-
The example is taken from https://github.com/assertj/assertj-examples/[assertj-examples] and more specifically https://github.com/assertj/assertj-examples/blob/main/assertions-examples/src/test/java/org/assertj/examples/custom/TolkienCharacterAssert.java[TolkienCharacterAssert.java].
150
+
The example is taken from {assertj-examples}/[assertj-examples] and more specifically {assertj-examples-base-package}/custom/TolkienCharacterAssert.java[TolkienCharacterAssert.java].
151
151
152
152
We want to have assertion for the `TolkienCharacter` domain model class shown below:
153
153
[source,java]
@@ -210,7 +210,7 @@ public class TolkienCharacterAssert extends AbstractAssert<TolkienCharacterAsser
210
210
To use our custom assertion class, simply call the `assertThat` factory method with the object to test:
211
211
[source,java]
212
212
----
213
-
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
213
+
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
// code is more elegant when TolkienCharacterAssert.assertThat is imported statically :
@@ -222,19 +222,19 @@ Well, that was not too difficult, but having to add a static import for each `as
222
222
[[assertj-core-custom-assertions-entry-point]]
223
223
===== Providing an entry point for all custom assertions
224
224
225
-
Now that you have a bunch of custom assertions classes, you want to access them easily. Just create a `CustomAssertions` class providing static `assertThat` methods for each of your assertions classes.
225
+
Now that you have a bunch of custom assertions classes, you want to access them easily. Just create a `CustomAssertions` class providing static `assertThat` methods for each of your assertions classes.
226
226
227
227
Example:
228
228
[source,java]
229
229
----
230
230
public class MyProjectAssertions {
231
231
232
-
// give access to TolkienCharacter assertion
232
+
// give access to TolkienCharacter assertion
233
233
public static TolkienCharacterAssert assertThat(TolkienCharacter actual) {
234
234
return new TolkienCharacterAssert(actual);
235
235
}
236
236
237
-
// give access to TolkienCharacter Race assertion
237
+
// give access to TolkienCharacter Race assertion
238
238
public static RaceAssert assertThat(Race actual) {
Copy file name to clipboardExpand all lines: src/docs/asciidoc/user-guide/assertj-core-migration.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ If the `*Test.java` file pattern does not suit you, just specify another as an a
78
78
After executing it, you will need to :
79
79
80
80
* Optimize imports with your IDE to remove unused imports.
81
-
* If you were using `assertEquals` with a delta to compare numbers, you will need to statically import `org.assertj.core.api.Assertions.within` which is how you express deltas in AssertJ (see the {assertj-examples-repo}/blob/main/assertions-examples/src/test/java/org/assertj/examples/NumberAssertionsExamples.java[number_assertions_with_offset_examples()] test at the end of `NumberAssertionsExamples`).
81
+
* If you were using `assertEquals` with a delta to compare numbers, you will need to statically import `org.assertj.core.api.Assertions.within` which is how you express deltas in AssertJ (see the {assertj-examples-github}/blob/main/assertions-examples/src/test/java/org/assertj/examples/NumberAssertionsExamples.java[number_assertions_with_offset_examples()] test at the end of `NumberAssertionsExamples`).
Copy file name to clipboardExpand all lines: src/docs/asciidoc/user-guide/assertj-core-quickstart.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,4 +186,4 @@ image::ide-completion.png[]
186
186
[[assertj-core-javadoc-quickstart]]
187
187
==== Javadoc
188
188
189
-
http://www.javadoc.io/doc/org.assertj/assertj-core/ is the latest version of AssertJ Core Javadoc, each assertion is explained, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
189
+
{assertj-core-javadoc} is the latest version of AssertJ Core Javadoc, each assertion is explained, most of them with code examples so be sure to check it if you want to know what a specific assertion does.
0 commit comments