Skip to content

Fix URLs to JavaDoc #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/docs/asciidoc/link-attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
:assertj-core-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-core/latest/
:assertj-guava-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-guava/latest/
:assertj-core-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org.assertj.core/
:assertj-guava-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-guava/latest/org.assertj.guava/
:assertj-joda-time-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-joda-time/latest/
//
:assertj-core-repo: https://github.com/assertj/assertj
:assertj-doc: https://github.com/assertj/doc
:assertj-examples-repo: https://github.com/assertj/assertj-examples
:assertj-examples-base-package: https://github.com/assertj/assertj-examples/blob/main/assertions-examples/src/test/java/org/assertj/examples/
:assertj-guava-repo: https://github.com/assertj/assertj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,19 +758,19 @@ expected: JEDI [name=Luke, age=23]
[[assertj-core-common-assertions]]
==== Common assertions

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].
This section describes the assertions common to all types, the Javadoc for common assertions methods is available {assertj-core-javadoc-root}org/assertj/core/api/AbstractAssert.html#method.summary[here].

[[assertj-core-object-assertions]]
==== Object assertions

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].
The Javadoc for `Object` assertions is available {assertj-core-javadoc-root}org/assertj/core/api/AbstractObjectAssert.html#method.summary[here].

[[assertj-string-object-assertions]]
==== String/CharSequence assertions

This section describes all the available assertions for `CharSequence` (including `String`, `StringBuilder`, `StringBuffer`, ...):

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].
The Javadoc for `CharSequence` assertions is available {assertj-core-javadoc-root}org/assertj/core/api/AbstractCharSequenceAssert.html#method.summary[here].


[[assertj-core-group-assertions]]
Expand Down Expand Up @@ -1269,7 +1269,7 @@ If you use java 7, check the link:#assertj-core-exception-assertions-java-7[Java

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.

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.
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.

Examples:
[source,java]
Expand Down
20 changes: 10 additions & 10 deletions src/docs/asciidoc/user-guide/assertj-core-extension.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AssertJ can be extends by Condition or writing your own assertions class.
[[assertj-core-conditions]]
==== Conditions

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.
Assertions can be extended by using conditions, to create a condition you just have to implement {assertj-core-javadoc-root}org/assertj/core/api/Condition.html[`org.assertj.assertions.core.Condition`] and its unique method matches.

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).

Expand All @@ -32,7 +32,7 @@ You can verify that a Condition is met on elements of a collection, with the fol

Moreover all Condition related methods have their negation counterpart, `is`/`isNot`, `have`/`doesNotHave`, `are`/`areNot`, ...

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].
The examples below are from {assertj-examples}/[assertj-examples] and more specifically {assertj-examples-base-package}condition/UsingConditionExamples.java[UsingConditionExamples.java].

[[assertj-core-condition-creation]]
===== Creating a Condition
Expand All @@ -46,7 +46,7 @@ import static org.assertj.core.util.Sets.newLinkedHashSet;
static Set<String> JEDIS = newLinkedHashSet("Luke", "Yoda", "Obiwan");

// implementation with Java 8 lambda
Condition<String> jediPower = new Condition<>(JEDIS::contains, "jedi power");
Condition<String> jediPower = new Condition<>(JEDIS::contains, "jedi power");

// implementation with Java 7
Condition<String> jedi = new Condition<String>("jedi") {
Expand Down Expand Up @@ -115,7 +115,7 @@ Let's define a sith condition:
[source,java]
----
List<String> SITHS = list("Sidious", "Vader", "Plagueis");
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
----

We can write these assertions:
Expand Down Expand Up @@ -147,7 +147,7 @@ Sections:

Let's see how to do that with an example!

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].
The example is taken from {assertj-examples}/[assertj-examples] and more specifically {assertj-examples-base-package}custom/TolkienCharacterAssert.java[TolkienCharacterAssert.java].

We want to have assertion for the `TolkienCharacter` domain model class shown below:
[source,java]
Expand Down Expand Up @@ -210,7 +210,7 @@ public class TolkienCharacterAssert extends AbstractAssert<TolkienCharacterAsser
To use our custom assertion class, simply call the `assertThat` factory method with the object to test:
[source,java]
----
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
TolkienCharacterAssert.assertThat(frodo).hasName("Frodo");

// code is more elegant when TolkienCharacterAssert.assertThat is imported statically :
Expand All @@ -222,19 +222,19 @@ Well, that was not too difficult, but having to add a static import for each `as
[[assertj-core-custom-assertions-entry-point]]
===== Providing an entry point for all custom assertions

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.
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.

Example:
[source,java]
----
public class MyProjectAssertions {

// give access to TolkienCharacter assertion
// give access to TolkienCharacter assertion
public static TolkienCharacterAssert assertThat(TolkienCharacter actual) {
return new TolkienCharacterAssert(actual);
}

// give access to TolkienCharacter Race assertion
// give access to TolkienCharacter Race assertion
public static RaceAssert assertThat(Race actual) {
return new RaceAssert(actual);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ import static my.project.MyOtherAssertions.assertThat;
@Test
public void ambiguous_assertThat_resolution() {
// ERROR: assertThat(String) is ambiguous!
// assertThat(String) is available from MyAssertions AND MyOtherAssertions
// assertThat(String) is available from MyAssertions AND MyOtherAssertions
// (it is defined in Assertions the class both MyAssertions and MyOtherAssertions inherits from)
assertThat("frodo").contains("do");
}
Expand Down
22 changes: 11 additions & 11 deletions src/docs/asciidoc/user-guide/assertj-core-release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

NOTE: AssertJ Core would not exist without its contributors, you can find them all {assertj-core-repo}/graphs/contributors[directly on GitHub].

The latest release notes can be found in the https://github.com/assertj/assertj/releases[GitHub releases].
The latest release notes can be found in the {assertj-core-repo}/releases[GitHub releases].

Older release notes:

Expand Down Expand Up @@ -1028,27 +1028,27 @@ This method is used with `usingFieldByFieldElementComparator()` which is depreca

When using `usingRecursiveComparison()` the equivalent is:

* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/RecursiveComparisonAssert.html#withEqualsForFields(java.util.function.BiPredicate,java.lang.String...)++[`RecursiveComparisonAssert.withEqualsForFields(java.util.function.BiPredicate, String...)`] or
* link:++https://www.javadoc.io/static/org.assertj/assertj-core/3.19.0/org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForFields(java.util.Comparator,java.lang.String...)++[`RecursiveComparisonAssert.withComparatorForFields(Comparator, String...)`]
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withEqualsForFields(java.util.function.BiPredicate,java.lang.String\...)[`RecursiveComparisonAssert.withEqualsForFields(java.util.function.BiPredicate, String...)`] or
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForFields(java.util.Comparator,java.lang.String\...)[`RecursiveComparisonAssert.withComparatorForFields(Comparator, String...)`]

and when using `usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration config)`, sets the config with:

* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withEqualsForFields(java.util.function.BiPredicate,java.lang.String...)++[`RecursiveComparisonConfiguration.Builder.withEqualsForFields(java.util.function.BiPredicate, String...)`] or
* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withComparatorForFields(java.util.Comparator,java.lang.String...)++[`RecursiveComparisonConfiguration.Builder.withComparatorForFields(Comparator, String...)`]
* {assertj-core-javadoc-root}org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withEqualsForFields(java.util.function.BiPredicate,java.lang.String\...)[`RecursiveComparisonConfiguration.Builder.withEqualsForFields(java.util.function.BiPredicate, String...)`] or
* {assertj-core-javadoc-root}org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withComparatorForFields(java.util.Comparator,java.lang.String\...)[`RecursiveComparisonConfiguration.Builder.withComparatorForFields(Comparator, String...)`]

[underline]#usingComparatorForElementFieldsWithType#

This method is used with `usingFieldByFieldElementComparator()` which is deprecated in favor of `usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration)` or `usingRecursiveComparison()`.

When using `usingRecursiveComparison()` the equivalent is:

* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/RecursiveComparisonAssert.html#withEqualsForType(java.util.function.BiPredicate,java.lang.Class)++[`RecursiveComparisonAssert.withEqualsForType(java.util.function.BiPredicate, Class)`] or
* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForType(java.util.Comparator,java.lang.Class)++[`RecursiveComparisonAssert.withComparatorForType(Comparator, Class)`]
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withEqualsForType(java.util.function.BiPredicate,java.lang.Class)[`RecursiveComparisonAssert.withEqualsForType(java.util.function.BiPredicate, Class)`] or
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForType(java.util.Comparator,java.lang.Class)[`RecursiveComparisonAssert.withComparatorForType(Comparator, Class)`]

and when] using `usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration config)`, sets the config with:

* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withEqualsForType(java.util.function.BiPredicate,java.lang.Class)++[`RecursiveComparisonConfiguration.Builder.withEqualsForType(java.util.function.BiPredicate, Class)`] or
* link:++https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withComparatorForType(java.util.Comparator,java.lang.Class)++[`RecursiveComparisonConfiguration.Builder.withComparatorForType(Comparator, Class)`]
* {assertj-core-javadoc-root}org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withEqualsForType(java.util.function.BiPredicate,java.lang.Class)[`RecursiveComparisonConfiguration.Builder.withEqualsForType(java.util.function.BiPredicate, Class)`] or
* {assertj-core-javadoc-root}org/assertj/core/api/recursive/comparison/RecursiveComparisonConfiguration.Builder.html#withComparatorForType(java.util.Comparator,java.lang.Class)[`RecursiveComparisonConfiguration.Builder.withComparatorForType(Comparator, Class)`]

[[assertj-core-3.20.0-containsIgnoringWhitespaces]]
[.release-note-item]#Add `containsIgnoringWhitespaces` to `String` assertions#
Expand Down Expand Up @@ -1342,7 +1342,7 @@ assertThat(Optional.of("a")).is(optionalWithLineSeparator)

A `VerboseCondition` shows the value under test when it fails thanks to the specified `objectUnderTestDescriptor` function.

When defining the `objectUnderTestDescriptor` function, you should take in consideration whether the condition is going to be used with link:https://www.javadoc.io/static/org.assertj/assertj-core/3.19.0/org/assertj/core/api/AbstractAssert.html#is(org.assertj.core.api.Condition)[`is(Condition)`] or link:https://www.javadoc.io/static/org.assertj/assertj-core/3.19.0/org/assertj/core/api/AbstractAssert.html#has(org.assertj.core.api.Condition)[`has(Condition)`] since the start of the error message is different between the two.
When defining the `objectUnderTestDescriptor` function, you should take in consideration whether the condition is going to be used with {assertj-core-javadoc-root}org/assertj/core/api/AbstractAssert.html#is(org.assertj.core.api.Condition)[`is(Condition)`] or {assertj-core-javadoc-root}org/assertj/core/api/AbstractAssert.html#has(org.assertj.core.api.Condition)[`has(Condition)`] since the start of the error message is different between the two.

Let's see how it works with an example that works well with `is(Condition)`:
[source,java]
Expand Down Expand Up @@ -2441,7 +2441,7 @@ assertThat(future).succeedsWithin(200, TimeUnit.MILLISECONDS, as(STRING))

Filters the iterable under test keeping only elements for which the result of the function is equal to expectedValue.

It allows to filter elements more safely than by using https://www.javadoc.io/static/org.assertj/assertj-core/3.16.1/org/assertj/core/api/AbstractIterableAssert.html#filteredOn(java.lang.String,java.lang.Object)[`filteredOn(String, Object)`] as it doesn't utilize introspection.
It allows to filter elements more safely than by using {assertj-core-javadoc-root}org/assertj/core/api/AbstractIterableAssert.html#filteredOn(java.lang.String,java.lang.Object)[`filteredOn(String, Object)`] as it doesn't utilize introspection.

As an example, let's check all employees 800 years old (yes, special employees):
Examples:
Expand Down
8 changes: 4 additions & 4 deletions src/docs/asciidoc/user-guide/assertj-core.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ programmers writing tests assertions with AssertJ.

AssertJ is a Java library that provides a rich set of assertions and truly helpful error messages, improves test code readability, and is designed to be super easy to use within your favorite IDE.

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.
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.

Here are a few examples of AssertJ assertions:

Expand Down Expand Up @@ -44,7 +44,7 @@ assertThatThrownBy(() -> { throw new Exception("boom!"); }).hasMessage("boom!");
Throwable thrown = catchThrowable(() -> { throw new Exception("boom!"); });
assertThat(thrown).hasMessageContaining("boom");

// using the 'extracting' feature to check fellowshipOfTheRing character's names
// using the 'extracting' feature to check fellowshipOfTheRing character's names
assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getName)
.doesNotContain("Sauron", "Elrond");

Expand All @@ -54,7 +54,7 @@ assertThat(fellowshipOfTheRing).extracting("name", "age", "race.name")
tuple("Sam", 38, "Hobbit"),
tuple("Legolas", 1000, "Elf"));

// filtering a collection before asserting
// filtering a collection before asserting
assertThat(fellowshipOfTheRing).filteredOn(character -> character.getName().contains("o"))
.containsOnly(aragorn, frodo, legolas, boromir);

Expand All @@ -77,7 +77,7 @@ Ask AssertJ related questions on {StackOverflow}.

You are very welcome to suggest or contribute improvements to this guide, that's one great way to give back to open source projects!

The repository containing the guide is https://github.com/assertj/doc, you can https://github.com/assertj/doc/issues[create a new issue], submit a pull request. Et voila!
The repository containing the guide is {assertj-doc}, you can {assertj-doc}/issues[create a new issue], submit a pull request. Et voila!

This guide is written with the awesome https://asciidoctor.org/docs/asciidoc-writers-guide/[Asciidoctor] which makes it easy to improve.

Expand Down
Loading