diff --git a/src/main/java/org/assertj/core/api/AbstractThrowableAssert.java b/src/main/java/org/assertj/core/api/AbstractThrowableAssert.java index 69728f2ba5..fa13dfbab8 100644 --- a/src/main/java/org/assertj/core/api/AbstractThrowableAssert.java +++ b/src/main/java/org/assertj/core/api/AbstractThrowableAssert.java @@ -12,6 +12,7 @@ */ package org.assertj.core.api; +import static java.lang.String.format; import static org.assertj.core.error.ShouldNotHaveThrown.shouldNotHaveThrown; import java.util.IllegalFormatException; @@ -91,7 +92,7 @@ public SELF hasMessage(String message) { * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. */ public SELF hasMessage(String message, Object... parameters) { - return hasMessage(String.format(message, parameters)); + return hasMessage(format(message, parameters)); } /** @@ -159,6 +160,15 @@ public SELF hasNoCause() { /** * Verifies that the message of the actual {@code Throwable} starts with the given description. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass:
+   * assertThat(throwableWithMessage).hasMessageStartingWith("wrong amount");
+   *
+   * // assertions will fail:
+   * assertThat(throwableWithMessage).hasMessageStartingWith("right amount"); 
* * @param description the description expected to start the actual {@code Throwable}'s message. * @return this assertion object. @@ -170,6 +180,31 @@ public SELF hasMessageStartingWith(String description) { return myself; } + /** + * Verifies that the message of the actual {@code Throwable} starts with the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass:
+   * assertThat(throwableWithMessage).hasMessageStartingWith("%s amount", "wrong");
+   *
+   * // assertions will fail:
+   * assertThat(throwableWithMessage).hasMessageStartingWith("%s amount", "right"); 
+ * + * @param description the description expected to start the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not start with the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + */ + public SELF hasMessageStartingWith(String description, Object... parameters) { + throwables.assertHasMessageStartingWith(info, actual, format(description, parameters)); + return myself; + } + /** * Verifies that the message of the actual {@code Throwable} contains the given description. *

@@ -194,6 +229,33 @@ public SELF hasMessageContaining(String description) { return myself; } + /** + * Verifies that the message of the actual {@code Throwable} contains the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   * Throwable throwableWithoutMessage = new IllegalArgumentException();
+   *
+   * // assertion will pass:
+   * assertThat(throwableWithMessage).hasMessageContaining("amount %d", 123);
+   *
+   * // assertions will fail:
+   * assertThat(throwableWithoutMessage).hasMessageContaining("amount %d", 123);
+   * assertThat(throwableWithMessage).hasMessageContaining("%s amount", "right"); 
+ * + * @param description the description expected to be contained in the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not contain the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + */ + public SELF hasMessageContaining(String description, Object... parameters) { + throwables.assertHasMessageContaining(info, actual, format(description, parameters)); + return myself; + } + /** * Verifies that the message of the actual {@code Throwable} contains all the given values. *

@@ -270,6 +332,15 @@ public SELF hasMessageNotContainingAny(CharSequence... values) { /** * Verifies that the stack trace of the actual {@code Throwable} contains the given description. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThat(throwableWithMessage).hasStackTraceContaining("amount 123");
+   *
+   * // assertion will fail
+   * assertThat(throwableWithMessage).hasStackTraceContaining("456");
* * @param description the description expected to be contained in the actual {@code Throwable}'s stack trace. * @return this assertion object. @@ -281,6 +352,31 @@ public SELF hasStackTraceContaining(String description) { return myself; } + /** + * Verifies that the stack trace of the actual {@code Throwable} contains the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThat(throwableWithMessage).hasStackTraceContaining("%s", amount);
+   *
+   * // assertion will fail
+   * assertThat(throwableWithMessage).hasStackTraceContaining("%d", 456);
+ * + * @param description the description expected to be contained in the actual {@code Throwable}'s stack trace. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the stack trace of the actual {@code Throwable} does not contain the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + */ + public SELF hasStackTraceContaining(String description, Object... parameters) { + throwables.assertHasStackTraceContaining(info, actual, format(description, parameters)); + return myself; + } + /** * Verifies that the message of the actual {@code Throwable} matches the given regular expression. *

@@ -334,6 +430,15 @@ public SELF hasMessageFindingMatch(String regex) { /** * Verifies that the message of the actual {@code Throwable} ends with the given description. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThat(throwableWithMessage).hasMessageEndingWith("123");
+   *
+   * // assertion will fail
+   * assertThat(throwableWithMessage).hasMessageEndingWith("456");
* * @param description the description expected to end the actual {@code Throwable}'s message. * @return this assertion object. @@ -345,6 +450,31 @@ public SELF hasMessageEndingWith(String description) { return myself; } + /** + * Verifies that the message of the actual {@code Throwable} ends with the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable throwableWithMessage = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThat(throwableWithMessage).hasMessageEndingWith("%s 123", "amount");
+   *
+   * // assertion will fail
+   * assertThat(throwableWithMessage).hasMessageEndingWith("amount %d", 456);
+ * + * @param description the description expected to end the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not end with the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + */ + public SELF hasMessageEndingWith(String description, Object... parameters) { + throwables.assertHasMessageEndingWith(info, actual, format(description, parameters)); + return myself; + } + /** * Verifies that the cause of the actual {@code Throwable} is an instance of the given type. *

diff --git a/src/main/java/org/assertj/core/api/ThrowableAssertAlternative.java b/src/main/java/org/assertj/core/api/ThrowableAssertAlternative.java index bae3496230..61a80efd0d 100644 --- a/src/main/java/org/assertj/core/api/ThrowableAssertAlternative.java +++ b/src/main/java/org/assertj/core/api/ThrowableAssertAlternative.java @@ -12,6 +12,7 @@ */ package org.assertj.core.api; +import java.util.IllegalFormatException; import org.assertj.core.description.Description; import org.assertj.core.util.CheckReturnValue; @@ -181,6 +182,36 @@ public ThrowableAssertAlternative withMessageStartingWith(String description) return this; } + /** + * Verifies that the message of the actual {@code Throwable} starts with the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable illegalArgumentException = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageStartingWith("%s amount", "wrong");
+   *
+   * // assertion will fail
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageStartingWith("%s amount", "right");
+ * + * @param description the description expected to start the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not start with the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + * @see AbstractThrowableAssert#hasMessageStartingWith(String, Object...) + */ + public ThrowableAssertAlternative withMessageStartingWith(String description, Object... parameters) { + delegate.hasMessageStartingWith(description, parameters); + return this; + } + /** * Verifies that the message of the actual {@code Throwable} contains the given description. *

@@ -208,6 +239,36 @@ public ThrowableAssertAlternative withMessageContaining(String description) { return this; } + /** + * Verifies that the message of the actual {@code Throwable} contains the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable illegalArgumentException = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageContaining("%s", amount);
+   *
+   * // assertion will fail
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageContaining("%d", 456);
+ * + * @param description the description expected to be contained in the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not contain the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + * @see AbstractThrowableAssert#hasMessageContaining(String, Object...) + */ + public ThrowableAssertAlternative withMessageContaining(String description, Object... parameters) { + delegate.hasMessageContaining(description, parameters); + return this; + } + /** * Verifies that the message of the actual {@code Throwable} contains all the given values. *

@@ -320,6 +381,36 @@ public ThrowableAssertAlternative withStackTraceContaining(String description return this; } + /** + * Verifies that the stack trace of the actual {@code Throwable} contains with the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable illegalArgumentException = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withStackTraceContaining("%s", amount);
+   *
+   * // assertion will fail
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withStackTraceContaining("%d", 456);
+ * + * @param description the description expected to be contained in the actual {@code Throwable}'s stack trace. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the stack trace of the actual {@code Throwable} does not contain the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + * @see AbstractThrowableAssert#hasStackTraceContaining(String, Object...) + */ + public ThrowableAssertAlternative withStackTraceContaining(String description, Object... parameters) { + delegate.hasStackTraceContaining(description, parameters); + return this; + } + /** * Verifies that the message of the actual {@code Throwable} matches with the given regular expression. *

@@ -375,6 +466,36 @@ public ThrowableAssertAlternative withMessageEndingWith(String description) { return this; } + /** + * Verifies that the message of the actual {@code Throwable} ends with the given description, after being formatted using + * the {@link String#format} method. + *

+ * Examples: + *

 Throwable illegalArgumentException = new IllegalArgumentException("wrong amount 123");
+   *
+   * // assertion will pass
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageEndingWith("%d", 123);
+   *
+   * // assertion will fail
+   * assertThatExceptionOfType(Throwable.class)
+   *           .isThrownBy(() -> {throw illegalArgumentException;})
+   *           .withMessageEndingWith("%d", 456);
+ * + * @param description the description expected to end the actual {@code Throwable}'s message. + * @param parameters argument referenced by the format specifiers in the format string + * @return this assertion object. + * @throws AssertionError if the actual {@code Throwable} is {@code null}. + * @throws AssertionError if the message of the actual {@code Throwable} does not end with the given description. + * @throws IllegalFormatException if the message contains an illegal syntax according to {@link String#format(String, Object...)}. + * @see AbstractThrowableAssert#hasMessageEndingWith(String, Object...) + */ + public ThrowableAssertAlternative withMessageEndingWith(String description, Object... parameters) { + delegate.hasMessageEndingWith(description, parameters); + return this; + } + /** * Verifies that the cause of the actual {@code Throwable} is an instance of the given type. *

diff --git a/src/test/java/org/assertj/core/api/Assertions_assertThatCode_Test.java b/src/test/java/org/assertj/core/api/Assertions_assertThatCode_Test.java index f2b4d3296a..e2215551e2 100644 --- a/src/test/java/org/assertj/core/api/Assertions_assertThatCode_Test.java +++ b/src/test/java/org/assertj/core/api/Assertions_assertThatCode_Test.java @@ -63,7 +63,7 @@ public void error_message_contains_stacktrace() { // Then assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> assertThatCode(boom).doesNotThrowAnyException()) - .withMessageContaining("java.lang.Exception: boom") + .withMessageContaining("java.lang.Exception: %s", "boom") .withMessageContaining("at org.assertj.core.api.Assertions_assertThatCode_Test.error_message_contains_stacktrace"); } diff --git a/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_hasNotFailed_Test.java b/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_hasNotFailed_Test.java index 2cd4927224..8cd2b5b343 100644 --- a/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_hasNotFailed_Test.java +++ b/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_hasNotFailed_Test.java @@ -57,7 +57,7 @@ public void should_fail_if_completable_future_has_failed() { assertThatThrownBy(() -> assertThat(future).hasNotFailed()).isInstanceOf(AssertionError.class) .hasMessageStartingWith(format("%nExpecting%n assertThat(future).isCompleted()).isInstanceOf(AssertionError.class) .hasMessageStartingWith(format("%nExpecting%n completedFuture = completedFuture("done"); + // THEN + assertThat(completedFuture).isNotCompletedExceptionally(); } @Test public void should_fail_when_completable_future_is_null() { - assertThatThrownBy(() -> assertThat((CompletableFuture) null).isNotCompletedExceptionally()).isInstanceOf(AssertionError.class) - .hasMessage(format(actualIsNull())); + // GIVEN + CompletableFuture future = null; + // WHEN + ThrowingCallable code = () -> assertThat(future).isNotCompletedExceptionally(); + // THEN + assertThatAssertionErrorIsThrownBy(code).withMessageStartingWith(actualIsNull()); } @Test - public void should_fail_if_completable_future_is_not_completed_exceptionally() { + public void should_fail_if_completable_future_is_completed_exceptionally() { + // GIVEN CompletableFuture future = new CompletableFuture<>(); future.completeExceptionally(new RuntimeException()); - - assertThatThrownBy(() -> assertThat(future).isNotCompletedExceptionally()).isInstanceOf(AssertionError.class) - .hasMessageStartingWith(format("%nExpecting%n assertThat(future).isNotCompletedExceptionally(); + // THEN + assertThatAssertionErrorIsThrownBy(code).withMessageStartingWith(format("%nExpecting%n { throw exceptionWithCause;}) - .withMessage("this too") - .withMessage("this %s", "too") + .withMessage("this too 234") + .withMessage("this %s %d", "too", 234) .withMessageStartingWith("this") - .withMessageEndingWith("too") + .withMessageStartingWith("%s", "this") + .withMessageEndingWith("234") + .withMessageEndingWith("too %d", 234) .withMessageMatching(".*is.*") .withStackTraceContaining("this") + .withStackTraceContaining("is %s", "to") .withCauseExactlyInstanceOf(IllegalArgumentException.class) .withCauseInstanceOf(IllegalArgumentException.class); // @format:on diff --git a/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageContaining_with_String_format_syntax_Test.java b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageContaining_with_String_format_syntax_Test.java new file mode 100644 index 0000000000..3c669d24ad --- /dev/null +++ b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageContaining_with_String_format_syntax_Test.java @@ -0,0 +1,36 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2012-2019 the original author or authors. + */ +package org.assertj.core.api.throwable; + +import static org.mockito.Mockito.verify; + +import org.assertj.core.api.ThrowableAssert; +import org.assertj.core.api.ThrowableAssertBaseTest; + +/** + * Tests for {@link ThrowableAssert#hasMessageContaining(String, Object...)}. + * + * @author Krishna Chaithanya Ganta + */ +public class ThrowableAssert_hasMessageContaining_with_String_format_syntax_Test extends ThrowableAssertBaseTest { + + @Override + protected ThrowableAssert invoke_api_method() { + return assertions.hasMessageContaining("able %s", "message"); + } + + @Override + protected void verify_internal_effects() { + verify(throwables).assertHasMessageContaining(getInfo(assertions), getActual(assertions), "able message"); + } +} diff --git a/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageEndingWith_with_String_format_syntax_Test.java b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageEndingWith_with_String_format_syntax_Test.java new file mode 100644 index 0000000000..bb8f303e8a --- /dev/null +++ b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageEndingWith_with_String_format_syntax_Test.java @@ -0,0 +1,36 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2012-2019 the original author or authors. + */ +package org.assertj.core.api.throwable; + +import static org.mockito.Mockito.verify; + +import org.assertj.core.api.ThrowableAssert; +import org.assertj.core.api.ThrowableAssertBaseTest; + +/** + * Tests for {@link ThrowableAssert#hasMessageEndingWith(String, Object...)}. + * + * @author Krishna Chaithanya Ganta + */ +public class ThrowableAssert_hasMessageEndingWith_with_String_format_syntax_Test extends ThrowableAssertBaseTest { + + @Override + protected ThrowableAssert invoke_api_method() { + return assertions.hasMessageEndingWith("%sage", "mess"); + } + + @Override + protected void verify_internal_effects() { + verify(throwables).assertHasMessageEndingWith(getInfo(assertions), getActual(assertions), "message"); + } +} diff --git a/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageStartingWith_with_String_format_syntax_Test.java b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageStartingWith_with_String_format_syntax_Test.java new file mode 100644 index 0000000000..9a64a02e0a --- /dev/null +++ b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasMessageStartingWith_with_String_format_syntax_Test.java @@ -0,0 +1,36 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2012-2019 the original author or authors. + */ +package org.assertj.core.api.throwable; + +import static org.mockito.Mockito.verify; + +import org.assertj.core.api.ThrowableAssert; +import org.assertj.core.api.ThrowableAssertBaseTest; + +/** + * Tests for {@link ThrowableAssert#hasMessageStartingWith(String, Object...)}. + * + * @author Krishna Chaithanya Ganta + */ +public class ThrowableAssert_hasMessageStartingWith_with_String_format_syntax_Test extends ThrowableAssertBaseTest { + + @Override + protected ThrowableAssert invoke_api_method() { + return assertions.hasMessageStartingWith("throw%s", "able"); + } + + @Override + protected void verify_internal_effects() { + verify(throwables).assertHasMessageStartingWith(getInfo(assertions), getActual(assertions), "throwable"); + } +} diff --git a/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasStackTraceContaining_with_String_format_syntax_Test.java b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasStackTraceContaining_with_String_format_syntax_Test.java new file mode 100644 index 0000000000..7d62776c4c --- /dev/null +++ b/src/test/java/org/assertj/core/api/throwable/ThrowableAssert_hasStackTraceContaining_with_String_format_syntax_Test.java @@ -0,0 +1,36 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2012-2019 the original author or authors. + */ +package org.assertj.core.api.throwable; + +import static org.mockito.Mockito.verify; + +import org.assertj.core.api.ThrowableAssert; +import org.assertj.core.api.ThrowableAssertBaseTest; + +/** + * Tests for {@link ThrowableAssert#hasStackTraceContaining(String, Object...)}. + * + * @author Krishna Chaithanya Ganta + */ +public class ThrowableAssert_hasStackTraceContaining_with_String_format_syntax_Test extends ThrowableAssertBaseTest { + + @Override + protected ThrowableAssert invoke_api_method() { + return assertions.hasStackTraceContaining("able%s", " message"); + } + + @Override + protected void verify_internal_effects() { + verify(throwables).assertHasStackTraceContaining(getInfo(assertions), getActual(assertions), "able message"); + } +} diff --git a/src/test/java/org/assertj/core/internal/throwables/Throwables_assertHasNoCause_Test.java b/src/test/java/org/assertj/core/internal/throwables/Throwables_assertHasNoCause_Test.java index 697c03cd9f..af19cc07a3 100644 --- a/src/test/java/org/assertj/core/internal/throwables/Throwables_assertHasNoCause_Test.java +++ b/src/test/java/org/assertj/core/internal/throwables/Throwables_assertHasNoCause_Test.java @@ -26,7 +26,7 @@ /** - * Tests for {@link Throwables#assertHasNoCause(AssertionInfo, Throwable, Class)}. + * Tests for {@link Throwables#assertHasNoCause(AssertionInfo, Throwable)}. * * @author Joel Costigliola */