Skip to content

Commit 3e1ba8e

Browse files
committed
add module to javadoc urls, use attributes for urls
1 parent 97e2e8b commit 3e1ba8e

10 files changed

+59
-58
lines changed

src/docs/asciidoc/link-attributes.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
:assertj-core-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-core/latest/
2-
:assertj-guava-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-guava/latest/
1+
:assertj-core-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-core/latest/org.assertj.core/
2+
:assertj-guava-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-guava/latest/org.assertj.guava/
33
:assertj-joda-time-javadoc-root: https://www.javadoc.io/doc/org.assertj/assertj-joda-time/latest/
44
//
55
:assertj-core-repo: https://github.com/assertj/assertj
6+
:assertj-doc: https://github.com/assertj/doc
67
:assertj-examples-repo: https://github.com/assertj/assertj-examples
78
:assertj-examples-base-package: https://github.com/assertj/assertj-examples/blob/main/assertions-examples/src/test/java/org/assertj/examples/
89
:assertj-guava-repo: https://github.com/assertj/assertj

src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,19 +758,19 @@ expected: JEDI [name=Luke, age=23]
758758
[[assertj-core-common-assertions]]
759759
==== Common assertions
760760

761-
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-root}org/assertj/core/api/AbstractAssert.html#method.summary[here].
762762

763763
[[assertj-core-object-assertions]]
764764
==== Object assertions
765765

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-root}org/assertj/core/api/AbstractObjectAssert.html#method.summary[here].
767767

768768
[[assertj-string-object-assertions]]
769769
==== String/CharSequence assertions
770770

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

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-root}org/assertj/core/api/AbstractCharSequenceAssert.html#method.summary[here].
774774

775775

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

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

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

12741274
Examples:
12751275
[source,java]

src/docs/asciidoc/user-guide/assertj-core-extension.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AssertJ can be extends by Condition or writing your own assertions class.
66
[[assertj-core-conditions]]
77
==== Conditions
88

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-root}org/assertj/core/api/Condition.html[`org.assertj.assertions.core.Condition`] and its unique method matches.
1010

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

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

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

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

3737
[[assertj-core-condition-creation]]
3838
===== Creating a Condition
@@ -46,7 +46,7 @@ import static org.assertj.core.util.Sets.newLinkedHashSet;
4646
static Set<String> JEDIS = newLinkedHashSet("Luke", "Yoda", "Obiwan");
4747
4848
// implementation with Java 8 lambda
49-
Condition<String> jediPower = new Condition<>(JEDIS::contains, "jedi power");
49+
Condition<String> jediPower = new Condition<>(JEDIS::contains, "jedi power");
5050
5151
// implementation with Java 7
5252
Condition<String> jedi = new Condition<String>("jedi") {
@@ -115,7 +115,7 @@ Let's define a sith condition:
115115
[source,java]
116116
----
117117
List<String> SITHS = list("Sidious", "Vader", "Plagueis");
118-
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
118+
Condition<String> sith = new Condition<>(SITHS::contains, "sith");
119119
----
120120

121121
We can write these assertions:
@@ -147,7 +147,7 @@ Sections:
147147

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

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

152152
We want to have assertion for the `TolkienCharacter` domain model class shown below:
153153
[source,java]
@@ -210,7 +210,7 @@ public class TolkienCharacterAssert extends AbstractAssert<TolkienCharacterAsser
210210
To use our custom assertion class, simply call the `assertThat` factory method with the object to test:
211211
[source,java]
212212
----
213-
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
213+
// use assertThat from TolkienCharacterAssert to check TolkienCharacter
214214
TolkienCharacterAssert.assertThat(frodo).hasName("Frodo");
215215
216216
// 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
222222
[[assertj-core-custom-assertions-entry-point]]
223223
===== Providing an entry point for all custom assertions
224224

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

227227
Example:
228228
[source,java]
229229
----
230230
public class MyProjectAssertions {
231231
232-
// give access to TolkienCharacter assertion
232+
// give access to TolkienCharacter assertion
233233
public static TolkienCharacterAssert assertThat(TolkienCharacter actual) {
234234
return new TolkienCharacterAssert(actual);
235235
}
236236
237-
// give access to TolkienCharacter Race assertion
237+
// give access to TolkienCharacter Race assertion
238238
public static RaceAssert assertThat(Race actual) {
239239
return new RaceAssert(actual);
240240
}
@@ -272,7 +272,7 @@ import static my.project.MyOtherAssertions.assertThat;
272272
@Test
273273
public void ambiguous_assertThat_resolution() {
274274
// ERROR: assertThat(String) is ambiguous!
275-
// assertThat(String) is available from MyAssertions AND MyOtherAssertions
275+
// assertThat(String) is available from MyAssertions AND MyOtherAssertions
276276
// (it is defined in Assertions the class both MyAssertions and MyOtherAssertions inherits from)
277277
assertThat("frodo").contains("do");
278278
}

src/docs/asciidoc/user-guide/assertj-core-release-notes.adoc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

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

88
Older release notes:
99

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

10291029
When using `usingRecursiveComparison()` the equivalent is:
10301030

1031-
* 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
1032-
* 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...)`]
1031+
* {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
1032+
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForFields(java.util.Comparator,java.lang.String\...)[`RecursiveComparisonAssert.withComparatorForFields(Comparator, String...)`]
10331033

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

1036-
* 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
1037-
* 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...)`]
1036+
* {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
1037+
* {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...)`]
10381038

10391039
[underline]#usingComparatorForElementFieldsWithType#
10401040

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

10431043
When using `usingRecursiveComparison()` the equivalent is:
10441044

1045-
* 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
1046-
* 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)`]
1045+
* {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
1046+
* {assertj-core-javadoc-root}org/assertj/core/api/RecursiveComparisonAssert.html#withComparatorForType(java.util.Comparator,java.lang.Class)[`RecursiveComparisonAssert.withComparatorForType(Comparator, Class)`]
10471047

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

1050-
* 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
1051-
* 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)`]
1050+
* {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
1051+
* {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)`]
10521052

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

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

1345-
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.
1345+
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.
13461346

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

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

2444-
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.
2444+
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.
24452445

24462446
As an example, let's check all employees 800 years old (yes, special employees):
24472447
Examples:

src/docs/asciidoc/user-guide/assertj-core.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ programmers writing tests assertions with AssertJ.
1111

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

14-
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.
14+
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.
1515

1616
Here are a few examples of AssertJ assertions:
1717

@@ -44,7 +44,7 @@ assertThatThrownBy(() -> { throw new Exception("boom!"); }).hasMessage("boom!");
4444
Throwable thrown = catchThrowable(() -> { throw new Exception("boom!"); });
4545
assertThat(thrown).hasMessageContaining("boom");
4646
47-
// using the 'extracting' feature to check fellowshipOfTheRing character's names
47+
// using the 'extracting' feature to check fellowshipOfTheRing character's names
4848
assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getName)
4949
.doesNotContain("Sauron", "Elrond");
5050
@@ -54,7 +54,7 @@ assertThat(fellowshipOfTheRing).extracting("name", "age", "race.name")
5454
tuple("Sam", 38, "Hobbit"),
5555
tuple("Legolas", 1000, "Elf"));
5656
57-
// filtering a collection before asserting
57+
// filtering a collection before asserting
5858
assertThat(fellowshipOfTheRing).filteredOn(character -> character.getName().contains("o"))
5959
.containsOnly(aragorn, frodo, legolas, boromir);
6060
@@ -77,7 +77,7 @@ Ask AssertJ related questions on {StackOverflow}.
7777

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

80-
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!
80+
The repository containing the guide is {assertj-doc}, you can {assertj-doc}/issues[create a new issue], submit a pull request. Et voila!
8181

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

0 commit comments

Comments
 (0)