Use assertThat(throwable).hasMessageThat() instead of assertThat(throwable.getMessage())
@@ -449,7 +449,8 @@ public class IterableSubjectTest {
public void iterableContainsAllOfFailsWithEmptyString() {
expectFailure.whenTesting().that(asList("a", null)).containsAllOf("", null);
- assertThat(expectFailure.getFailure().getMessage())
+ assertThat(expectFailure.getFailure())
+ .hasMessageThat()
.isEqualTo(
"Not true that <[a, null]> contains all of <[\"\" (empty String), null]>. "
+ "It is missing <[\"\" (empty String)]>");
@@ -583,7 +584,8 @@ public class IterableSubjectTest {
public void iterableContainsNoneOfFailureWithEmptyString() {
expectFailure.whenTesting().that(asList("")).containsNoneOf("", null);
- assertThat(expectFailure.getFailure().getMessage())
+ assertThat(expectFailure.getFailure())
+ .hasMessageThat()
.isEqualTo(
"Not true that <[]> contains none of <[\"\" (empty String), null]>. "
+ "It contains <[\"\" (empty String)]>");
@@ -661,7 +663,8 @@ public class IterableSubjectTest {
public void iterableContainsExactlyWithEmptyString() {
expectFailure.whenTesting().that(asList()).containsExactly("");
- assertThat(expectFailure.getFailure().getMessage())
+ assertThat(expectFailure.getFailure())
+ .hasMessageThat()
.isEqualTo(
"Not true that <[]> contains exactly <[\"\" (empty String)]>. "
+ "It is missing <[\"\" (empty String)]>");
@@ -671,7 +674,8 @@ public class IterableSubjectTest {
public void iterableContainsExactlyWithEmptyStringAndUnexpectedItem() {
expectFailure.whenTesting().that(asList("a", null)).containsExactly("");
- assertThat(expectFailure.getFailure().getMessage())
+ assertThat(expectFailure.getFailure())
+ .hasMessageThat()
.isEqualTo(
"Not true that <[a, null]> contains exactly <[\"\" (empty String)]>. "
+ "It is missing <[\"\" (empty String)]> and has unexpected items <[a, null]>");
@@ -681,7 +685,8 @@ public class IterableSubjectTest {
public void iterableContainsExactlyWithEmptyStringAndMissingItem() {
expectFailure.whenTesting().that(asList("")).containsExactly("a", null);
- assertThat(expectFailure.getFailure().getMessage())
+ assertThat(expectFailure.getFailure())
+ .hasMessageThat()
.isEqualTo(
"Not true that <[]> contains exactly <[a, null]>. "
+ "It is missing <[a, null]> and has unexpected items <[\"\" (empty String)]>");
