Skip to content

Commit 9756d93

Browse files
committed
Fix javadoc generation
1 parent c857895 commit 9756d93

File tree

19 files changed

+282
-627
lines changed

19 files changed

+282
-627
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: ./mvnw -B verify javadoc:javadoc
2828
- name: Sonar Analysis
2929
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
30-
run: ./mvnw -B sonar:sonar --file pom.xml
30+
run: ./mvnw -B sonar:sonar
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
</issueManagement>
3030

3131
<properties>
32-
<javadocAdditionalOptions>--allow-script-in-comments</javadocAdditionalOptions>
33-
3432
<!-- SonarCloud -->
3533
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
3634
<sonar.organization>assertj</sonar.organization>
@@ -181,19 +179,7 @@
181179
<groupId>org.apache.maven.plugins</groupId>
182180
<artifactId>maven-javadoc-plugin</artifactId>
183181
<configuration>
184-
<!-- (1) CSS file location -->
185-
<stylesheetfile>src/main/javadoc/assertj-javadoc.css</stylesheetfile>
186-
<!-- (2) Highlight Javascript file -->
187-
<top><![CDATA[
188-
<script src="http://cdn.jsdelivr.net/highlight.js/8.6/highlight.min.js"></script>
189-
]]></top>
190-
<!-- init Highlight -->
191-
<footer><![CDATA[
192-
<script type="text/javascript">
193-
hljs.initHighlightingOnLoad();
194-
</script>
195-
]]></footer>
196-
<additionalJOption>${javadocAdditionalOptions}</additionalJOption>
182+
<javadocDirectory>${rootDirectory}/src/main/javadoc/</javadocDirectory>
197183
</configuration>
198184
</plugin>
199185
<plugin>

src/main/java/org/assertj/db/api/AbstractSoftAssertions.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@
2121
*
2222
* @author Julien Roy
2323
*/
24-
public class AbstractSoftAssertions {
24+
class AbstractSoftAssertions {
2525

26-
protected final SoftProxies proxies = new SoftProxies();
26+
private final SoftProxies proxies = new SoftProxies();
2727

28-
public <T, V> V proxy(Class<V> assertClass, Class<T> actualClass, T actual) {
28+
<T, V> V proxy(Class<V> assertClass, Class<T> actualClass, T actual) {
2929
return this.proxies.create(assertClass, actualClass, actual);
3030
}
3131

32-
public List<Throwable> errorsCollected() {
32+
List<Throwable> errorsCollected() {
3333
return Lists.newArrayList(this.proxies.errorsCollected());
3434
}
3535

36-
public boolean wasSuccess() {
36+
boolean wasSuccess() {
3737
return this.proxies.wasSuccess();
3838
}
3939
}

src/main/java/org/assertj/db/api/ErrorCollector.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,21 @@
2626

2727
/**
2828
* Collects error messages of all AssertionErrors thrown by the proxied method.
29+
*
30+
* @author Julien Roy
2931
*/
3032
public class ErrorCollector {
3133

3234
private static final String INTERCEPT_METHOD_NAME = "intercept";
3335

3436
private static final String CLASS_NAME = ErrorCollector.class.getName();
3537

38+
/**
39+
* Construct empty error collector.
40+
*/
41+
public ErrorCollector() {
42+
}
43+
3644
// scope : the current soft-assertion object
3745
private final List<Throwable> errors = new ArrayList<>();
3846
// scope : the last assertion call (might be nested)
@@ -48,6 +56,16 @@ private static int countErrorCollectorProxyCalls() {
4856
return nbCalls;
4957
}
5058

59+
/**
60+
* Apply interception of assertion method to collect exception and avoid stop the assertion flow on the first error.
61+
*
62+
* @param assertion The assertion object proxied
63+
* @param proxy The proxy of assertion
64+
* @param method The method of assertion called
65+
* @param stub The sub value if not assert method is found
66+
* @return The current assertion object.
67+
* @throws Exception When interception fail
68+
*/
5169
@RuntimeType
5270
public Object intercept(
5371
@This Object assertion,
@@ -73,15 +91,30 @@ public Object intercept(
7391
return assertion;
7492
}
7593

94+
/**
95+
* Append new error to collection of errors.
96+
*
97+
* @param error Any throwable
98+
*/
7699
public void addError(Throwable error) {
77100
errors.add(error);
78101
lastResult.recordError();
79102
}
80103

104+
/**
105+
* Return all errors collected.
106+
*
107+
* @return List of exception
108+
*/
81109
public List<Throwable> errors() {
82110
return Collections.unmodifiableList(errors);
83111
}
84112

113+
/**
114+
* Return if no error collected in this instance.
115+
*
116+
* @return true if no errors.
117+
*/
85118
public boolean wasSuccess() {
86119
return lastResult.wasSuccess();
87120
}

src/main/java/org/assertj/db/api/ProxifyPositionResult.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
package org.assertj.db.api;
1414

15-
import static org.assertj.db.util.Proxies.isProxified;
15+
import static org.assertj.db.util.Proxies.isProxied;
1616
import static org.assertj.db.util.Proxies.unProxy;
1717

1818
import java.util.concurrent.Callable;
@@ -106,11 +106,18 @@ private static Object[] actual(Object result) {
106106
}
107107
}
108108

109+
/**
110+
* Method called during interception of positional method.
111+
*
112+
* @param proxy Proxy method to use
113+
* @return the object result proxied
114+
* @throws Exception When method call fail
115+
*/
109116
@RuntimeType
110117
public Object intercept(@SuperCall Callable<?> proxy) throws Exception {
111118
Object result = proxy.call();
112119

113-
if (isProxified(result.getClass()) || Arrays.isNullOrEmpty(actual(result))) {
120+
if (isProxied(result.getClass()) || Arrays.isNullOrEmpty(actual(result))) {
114121
return result;
115122
}
116123
return this.proxies.create(result.getClass(), actualClass(result), actual(result));

src/main/java/org/assertj/db/api/SoftAssertions.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
*/
3333
public final class SoftAssertions extends AbstractSoftAssertions {
3434

35+
/**
36+
* Create a new SoftAssertions class that allow chain many assertion and detect all assertion failure ( not only the first one ).
37+
*/
38+
public SoftAssertions() {
39+
super();
40+
}
41+
3542
/**
3643
* Creates a new instance of {@link TableAssert}.
3744
*
@@ -62,6 +69,11 @@ public ChangesAssert assertThat(Changes changes) {
6269
return proxy(ChangesAssert.class, Changes.class, changes);
6370
}
6471

72+
/**
73+
* Assert that all assertions succeed.
74+
*
75+
* @throws SoftAssertionError If any assertion failed.
76+
*/
6577
public void assertAll() {
6678
List<Throwable> errors = this.errorsCollected();
6779
if (!errors.isEmpty()) {

src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnRowCondition.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ private AssertionsOnRowCondition() {
4848
// Empty
4949
}
5050

51+
/**
52+
* Verifies that the values of a row satisfy to conditions in parameter.
53+
*
54+
* @param <A> The type of the assertion which call this method.
55+
* @param assertion The assertion which call this method.
56+
* @param info Writable information about an assertion.
57+
* @param valuesList The actual value to validate.
58+
* @param expected The expected conditions.
59+
* @return {@code this} assertion object.
60+
* @throws AssertionError If the columns of the primary key are different to the names in parameters.
61+
*/
62+
@SuppressWarnings("unchecked")
5163
public static <A extends AbstractAssert<?>> A hasValuesSatisfying(A assertion, WritableAssertionInfo info,
5264
List<Value> valuesList, Object... expected) {
5365

src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnTableExistence.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ private AssertionsOnTableExistence() {
4444
// Empty
4545
}
4646

47+
/**
48+
* Verifies that the table exists.
49+
*
50+
* @param <A> The type of the assertion which call this method.
51+
* @param assertion The assertion which call this method.
52+
* @param info Writable information about an assertion.
53+
* @param table The table name to search in DB.
54+
* @param source The source to connect to DB.
55+
* @param dataSource The source to connect to DB.
56+
* @return {@code this} assertion object.
57+
* @throws AssertionError If the table does not exist.
58+
*/
4759
public static <A extends AbstractDbAssert<?, ?, ?, ?, ?, ?>> A exists(A assertion, WritableAssertionInfo info,
4860
String table, Source source, DataSource dataSource) {
4961
try (Connection connection = getConnection(source, dataSource)) {
@@ -59,6 +71,19 @@ private AssertionsOnTableExistence() {
5971
return assertion;
6072
}
6173

74+
75+
/**
76+
* Verifies that the database not contains the table.
77+
*
78+
* @param <A> The type of the assertion which call this method.
79+
* @param assertion The assertion which call this method.
80+
* @param info Writable information about an assertion.
81+
* @param table The table name to search in DB.
82+
* @param source The source to connect to DB.
83+
* @param dataSource The source to connect to DB.
84+
* @return {@code this} assertion object.
85+
* @throws AssertionError If the table does not exist.
86+
*/
6287
public static <A extends AbstractDbAssert<?, ?, ?, ?, ?, ?>> A doesNotExists(A assertion, WritableAssertionInfo info,
6388
String table, Source source, DataSource dataSource) {
6489
try (Connection connection = getConnection(source, dataSource)) {

src/main/java/org/assertj/db/error/ShouldSatisfy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ private ShouldSatisfy(int index, Object actual, Condition<?> condition) {
2929
super(EXPECTED_MESSAGE_WITH_INDEX, index, actual, condition);
3030
}
3131

32+
/**
33+
* Verifies that the values of a row satisfy to conditions in parameter.
34+
*
35+
* @param index The index of properties
36+
* @param actual The actual value that triggered assertion error.
37+
* @param condition The condition that triggered assertion error.
38+
* @return {@code this} condition not satisfied error message.
39+
*/
3240
public static ErrorMessageFactory shouldSatisfy(int index, Object actual, Condition<?> condition) {
3341
return new ShouldSatisfy(index, actual, condition);
3442
}

src/main/java/org/assertj/db/output/impl/PlainOutput.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public String getTableOutput(WritableAssertionInfo info, Table table) {
435435
List<String> typesList = OutputType.getTypesList(rows);
436436
int indexColumnSize = getIndexColumnSize(rows.length);
437437
StringBuilder[] pksValueStringBuilders = OutputType.getPksValueStringBuilder(rows);
438-
int primaryKeyColumnSize = getColumnSize("PRIMARY", pksValueStringBuilders);
438+
int primaryKeyColumnSize = getColumnSize("PRIMARY", (Object[]) pksValueStringBuilders);
439439
List<Integer> sizesList = getSizesList(rows.length == 0 ? getColumnSizesList(columnsNameList) : getColumnSizesList(rows),
440440
indexColumnSize,
441441
primaryKeyColumnSize);
@@ -481,7 +481,7 @@ public String getRequestOutput(WritableAssertionInfo info, Request request) {
481481
List<String> typesList = OutputType.getTypesList(rows);
482482
int indexColumnSize = getIndexColumnSize(rows.length);
483483
StringBuilder[] pksValueStringBuilders = OutputType.getPksValueStringBuilder(rows);
484-
int primaryKeyColumnSize = getColumnSize("PRIMARY", pksValueStringBuilders);
484+
int primaryKeyColumnSize = getColumnSize("PRIMARY", (Object[]) pksValueStringBuilders);
485485
List<Integer> sizesList = getSizesList(rows.length == 0 ? getColumnSizesList(columnsNameList) : getColumnSizesList(rows),
486486
indexColumnSize,
487487
primaryKeyColumnSize);
@@ -528,7 +528,7 @@ public String getChangesOutput(WritableAssertionInfo info, Changes changes) {
528528
int changeTypeColumnSize = getChangeTypeColumnSize(changesArray);
529529
int dataTypeColumnSize = getDataTypeColumnSize(changesArray);
530530
StringBuilder[] pksValueStringBuilders = OutputType.getPksValueStringBuilder(changesArray);
531-
int primaryKeyColumnSize = getColumnSize("PRIMARY", pksValueStringBuilders);
531+
int primaryKeyColumnSize = getColumnSize("PRIMARY", (Object[]) pksValueStringBuilders);
532532

533533
StringBuilder stringBuilder = new StringBuilder();
534534
// Description
@@ -598,7 +598,7 @@ public String getChangeOutput(WritableAssertionInfo info, Change change) {
598598

599599
int changeTypeColumnSize = getColumnSize("TYPE", changeType);
600600
int dataTypeColumnSize = getColumnSize("" + dataType, dataName);
601-
int primaryKeyColumnSize = getColumnSize("PRIMARY", pksValueStringBuilders);
601+
int primaryKeyColumnSize = getColumnSize("PRIMARY", (Object[]) pksValueStringBuilders);
602602
List<Integer> sizesList = getSizesList(getColumnSizesList(rowAtStartPoint, rowAtEndPoint),
603603
changeTypeColumnSize,
604604
dataTypeColumnSize,
@@ -646,7 +646,7 @@ public String getRowOutput(WritableAssertionInfo info, Row row) {
646646
List<String> columnsNameList = row.getColumnsNameList();
647647
List<String> typesList = OutputType.getTypesList(row);
648648
StringBuilder[] pksValueStringBuilders = OutputType.getPksValueStringBuilder(row);
649-
int primaryKeyColumnSize = getColumnSize("PRIMARY", pksValueStringBuilders);
649+
int primaryKeyColumnSize = getColumnSize("PRIMARY", (Object[]) pksValueStringBuilders);
650650
List<Integer> sizesList = getSizesList(getColumnSizesList(row),
651651
primaryKeyColumnSize);
652652

0 commit comments

Comments
 (0)