Skip to content
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

Use AssertionError(String, Throwable) instead of supplying the cause later. #1297

Merged
1 commit merged into from
May 29, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ final class AssertionErrorWithFacts extends AssertionError implements ErrorWithF

AssertionErrorWithFacts(
ImmutableList<String> messages, ImmutableList<Fact> facts, @Nullable Throwable cause) {
super(makeMessage(messages, facts));
super(makeMessage(messages, facts), cause);
this.facts = checkNotNull(facts);

initCause(cause);
}

@Override
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/Truth.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ public static PathSubject assertThat(@Nullable Path actual) {
@SuppressWarnings("OverrideThrowableToString") // We intentionally replace the normal format.
static final class SimpleAssertionError extends AssertionError {
private SimpleAssertionError(String message, @Nullable Throwable cause) {
super(checkNotNull(message));

initCause(cause);
super(checkNotNull(message), cause);
}

static SimpleAssertionError create(String message, @Nullable Throwable cause) {
Expand Down