From 4ccdbcc1dde6dc783c51cfca2b96dc38429515cd Mon Sep 17 00:00:00 2001 From: Thomas Traude Date: Sat, 27 Dec 2025 21:20:10 +0100 Subject: [PATCH] Replace use of deprecated catchThrowableOfType --- .../asciidoc/user-guide/assertj-core-assertions-guide.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc b/src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc index ce5ef1e..dc8c626 100644 --- a/src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc +++ b/src/docs/asciidoc/user-guide/assertj-core-assertions-guide.adoc @@ -1442,15 +1442,15 @@ class TextException extends Exception { } } - TextException textException = catchThrowableOfType(() -> { throw new TextException("boom!", 1, 5); }, - TextException.class); + TextException textException = catchThrowableOfType(TextException.class, + () -> { throw new TextException("boom!", 1, 5); }); // assertions succeed assertThat(textException).hasMessageContaining("boom"); assertThat(textException.line).isEqualTo(1); assertThat(textException.column).isEqualTo(5); // fails as TextException is not a RuntimeException - catchThrowableOfType(() -> { throw new TextException("boom!", 1, 5); }, RuntimeException.class); + catchThrowableOfType(RuntimeException.class, () -> { throw new TextException("boom!", 1, 5); }); ---- Although the example above can be used for any exception type, enriched alternatives for `catchThrowableOfType` are also available to catch an instance of various commonly used exceptions: