and withFailMessage has
- //overloads for both types.
+
+ // In assertJ the "as" method has a more informative error message, but doesn't accept String suppliers
+ // so we're using "as" if the message is a string and "withFailMessage" if it is a supplier.
+ if (message != null && TypeUtils.isString(message.getType())) {
+ //If this is the three-argument variant and the third argument is a string
+ assertSelect = new J.MethodInvocation(
+ randomId(),
+ assertSelect, //assertThat is the select for this method.
+ null,
+ J.Ident.build(randomId(), "as", null, EMPTY),
+ new J.MethodInvocation.Arguments(
+ randomId(),
+ Collections.singletonList(message.withPrefix("")),
+ EMPTY
+ ),
+ null,
+ EMPTY
+ );
+ } else if (message != null) {
+ //If this is the three-argument variant and the third argument is a string supplier
assertSelect = new J.MethodInvocation(
randomId(),
assertSelect, //assertThat is the select for this method.
@@ -141,6 +146,9 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method) {
//Make sure there is a static import for "org.assertj.core.api.Assertions.assertThat"
maybeAddImport(ASSERTJ_QUALIFIED_ASSERTIONS_CLASS_NAME, ASSERTJ_ASSERT_THAT_METHOD_NAME);
+ //And if there are no longer references to the JUnit assertions class, we can remove the import.
+ maybeRemoveImport(JUNIT_QUALIFIED_ASSERTIONS_CLASS_NAME);
+
//Format the replacement method invocation in the context of where it is called.
andThen(new AutoFormat(replacement));
return replacement;
diff --git a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertArrayEqualsToAssertThatTest.kt b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertArrayEqualsToAssertThatTest.kt
new file mode 100644
index 000000000..4c8e593ce
--- /dev/null
+++ b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertArrayEqualsToAssertThatTest.kt
@@ -0,0 +1,325 @@
+/*
+ * Copyright 2020 the original author or authors.
+ *
+ * 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
+ *
+ * https://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.
+ */
+package org.openrewrite.java.testing.junitassertj
+
+import org.junit.jupiter.api.Test
+import org.openrewrite.Parser
+import org.openrewrite.RefactorVisitor
+import org.openrewrite.RefactorVisitorTestForParser
+import org.openrewrite.java.JavaParser
+import org.openrewrite.java.tree.J
+
+class AssertArrayEqualsToAssertThatTest: RefactorVisitorTestForParser {
+ override val parser: Parser = JavaParser.fromJavaVersion()
+ .classpath("junit", "assertj-core", "apiguardian-api")
+ .build()
+
+ override val visitors: Iterable> = listOf(AssertArrayEqualsToAssertThat())
+
+ @Test
+ fun singleStaticMethodNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ Integer[] expected = new Integer[] {1, 2, 3};
+ assertArrayEquals(expected, notification());
+ }
+ private Integer[] notification() {
+ return new Integer[] {1, 2, 3};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ Integer[] expected = new Integer[] {1, 2, 3};
+ assertThat(notification()).containsExactly(expected);
+ }
+ private Integer[] notification() {
+ return new Integer[] {1, 2, 3};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun singleStaticMethodWithMessageLambda() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new int[] {1, 2, 3}, notification(), () -> "These arrays should be equal");
+ }
+ private int[] notification() {
+ return new int[] {1, 2, 3};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).withFailMessage(() -> "These arrays should be equal").containsExactly(new int[] {1, 2, 3});
+ }
+ private int[] notification() {
+ return new int[] {1, 2, 3};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doublesWithinNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new double[] {1.0d, 2.0d, 3.0d}, notification(), .2d);
+ }
+ private double[] notification() {
+ return new double[] {1.1d, 2.1d, 3.1d};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).containsExactly(new double[] {1.0d, 2.0d, 3.0d}, within(.2d));
+ }
+ private double[] notification() {
+ return new double[] {1.1d, 2.1d, 3.1d};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doublesWithinAndWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new double[] {1.0d, 2.0d, 3.0d}, notification(), .2d, "These should be close");
+ }
+ private double[] notification() {
+ return new double[] {1.1d, 2.1d, 3.1d};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).as("These should be close").containsExactly(new double[] {1.0d, 2.0d, 3.0d}, within(.2d));
+ }
+ private double[] notification() {
+ return new double[] {1.1d, 2.1d, 3.1d};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doublesObjectsWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new Double[] {1.0d, 2.0d, 3.0d}, notification(), "These arrays should be equal");
+ }
+ private Double[] notification() {
+ return new Double[] {1.0d, 2.0d, 3.0d};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).as("These arrays should be equal").containsExactly(new Double[] {1.0d, 2.0d, 3.0d});
+ }
+ private Double[] notification() {
+ return new Double[] {1.0d, 2.0d, 3.0d};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun floatCloseToWithNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new float[] {1.0f, 2.0f, 3.0f}, notification(), .2f);
+ }
+ private float[] notification() {
+ return new float[] {1.1f, 2.1f, 3.1f};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).containsExactly(new float[] {1.0f, 2.0f, 3.0f}, within(.2f));
+ }
+ private float[] notification() {
+ return new float[] {1.1f, 2.1f, 3.1f};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun floatCloseToWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertArrayEquals(new float[] {1.0f, 2.0f, 3.0f}, notification(), .2f, () -> "These should be close");
+ }
+ private float[] notification() {
+ return new float[] {1.1f, 2.1f, 3.1f};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).withFailMessage(() -> "These should be close").containsExactly(new float[] {1.0f, 2.0f, 3.0f}, within(.2f));
+ }
+ private float[] notification() {
+ return new float[] {1.1f, 2.1f, 3.1f};
+ }
+ }
+ """
+ )
+
+ @Test
+ fun fullyQualifiedMethodWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ public class A {
+
+ @Test
+ public void test() {
+ String[] expected = new String[] {"Fred", "Alice", "Mary"};
+ org.junit.jupiter.api.Assertions.assertArrayEquals(expected, notification(), () -> "These should be close");
+ }
+ private String[] notification() {
+ return new String[] {"Fred", "Alice", "Mary"};
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ String[] expected = new String[] {"Fred", "Alice", "Mary"};
+ assertThat(notification()).withFailMessage(() -> "These should be close").containsExactly(expected);
+ }
+ private String[] notification() {
+ return new String[] {"Fred", "Alice", "Mary"};
+ }
+ }
+ """
+ )
+}
\ No newline at end of file
diff --git a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertEqualsToAssertThatTest.kt b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertEqualsToAssertThatTest.kt
index 195d45f55..a7dde43c6 100644
--- a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertEqualsToAssertThatTest.kt
+++ b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertEqualsToAssertThatTest.kt
@@ -76,7 +76,7 @@ class AssertEqualsToAssertThatTest: RefactorVisitorTestForParser "These should be equal");
}
private String notification() {
return "fred";
@@ -92,7 +92,7 @@ class AssertEqualsToAssertThatTest: RefactorVisitorTestForParser "These should be equal").isEqualTo("fred");
}
private String notification() {
return "fred";
@@ -166,7 +166,7 @@ class AssertEqualsToAssertThatTest: RefactorVisitorTestForParser "These should be close.");
+ }
+ private double notification() {
+ return Double.valueOf(0.1d);
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).withFailMessage(() -> "These should be close.").isCloseTo(Double.valueOf(0.0d), within(Double.valueOf(0.2d)));
+ }
+ private double notification() {
+ return Double.valueOf(0.1d);
+ }
+ }
+ """
+ )
+
@Test
fun floatCloseToWithNoMessage() = assertRefactored(
before = """
@@ -240,7 +277,7 @@ class AssertEqualsToAssertThatTest: RefactorVisitorTestForParser 0).withFailMessage("The notification should be negative").isFalse();
+ assertThat(notification() != null && notification() > 0).as("The notification should be negative").isFalse();
}
private Integer notification() {
return 1;
@@ -165,7 +165,7 @@ class AssertFalseToAssertThatTest: RefactorVisitorTestForParser 0).isFalse();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be negative").isFalse();
+ assertThat(notification() != null && notification() > 0).as("The notification should be negative").isFalse();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be negative").isFalse();
}
private Integer notification() {
@@ -206,7 +206,7 @@ class AssertFalseToAssertThatTest: RefactorVisitorTestForParser 0).isFalse();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be negative").isFalse();
+ assertThat(notification() != null && notification() > 0).as("The notification should be negative").isFalse();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be negative").isFalse();
}
private Integer notification() {
@@ -250,7 +250,7 @@ class AssertFalseToAssertThatTest: RefactorVisitorTestForParser 0).isFalse();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be negative").isFalse();
+ assertThat(notification() != null && notification() > 0).as("The notification should be negative").isFalse();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be negative").isFalse();
assertFalse(() -> notification() != null && notification() > 0);
assertFalse(() -> notification() != null && notification() > 0, "The notification should be negative");
diff --git a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertNotEqualsToAssertThatTest.kt b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertNotEqualsToAssertThatTest.kt
new file mode 100644
index 000000000..2bfc39a8b
--- /dev/null
+++ b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertNotEqualsToAssertThatTest.kt
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2020 the original author or authors.
+ *
+ * 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
+ *
+ * https://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.
+ */
+package org.openrewrite.java.testing.junitassertj
+
+import org.junit.jupiter.api.Test
+import org.openrewrite.Parser
+import org.openrewrite.RefactorVisitor
+import org.openrewrite.RefactorVisitorTestForParser
+import org.openrewrite.java.JavaParser
+import org.openrewrite.java.tree.J
+
+class AssertNotEqualsToAssertThatTest: RefactorVisitorTestForParser {
+ override val parser: Parser = JavaParser.fromJavaVersion()
+ .classpath("junit", "assertj-core", "apiguardian-api")
+ .build()
+
+ override val visitors: Iterable> = listOf(AssertNotEqualsToAssertThat())
+
+ @Test
+ fun singleStaticMethodNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(1, notification());
+ }
+ private Integer notification() {
+ return 2;
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).isNotEqualTo(1);
+ }
+ private Integer notification() {
+ return 2;
+ }
+ }
+ """
+ )
+
+ @Test
+ fun singleStaticMethodWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals("fred", notification(), () -> "These should not be equal");
+ }
+ private String notification() {
+ return "joe";
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).withFailMessage(() -> "These should not be equal").isNotEqualTo("fred");
+ }
+ private String notification() {
+ return "joe";
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doubleCloseToWithNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(0.0d, notification(), 0.2d);
+ }
+ private Double notification() {
+ return 1.1d;
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).isNotCloseTo(0.0d, within(0.2d));
+ }
+ private Double notification() {
+ return 1.1d;
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doubleCloseToWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(2.0d, notification(), 0.2d, "These should not be close.");
+ }
+ private double notification() {
+ return 0.1d;
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).as("These should not be close.").isNotCloseTo(2.0d, within(0.2d));
+ }
+ private double notification() {
+ return 0.1d;
+ }
+ }
+ """
+ )
+
+ @Test
+ fun doubleObjectsCloseToWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(Double.valueOf(0.0d), notification(), Double.valueOf(0.2d), () -> "These should not be close.");
+ }
+ private double notification() {
+ return Double.valueOf(1.1d);
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).withFailMessage(() -> "These should not be close.").isNotCloseTo(Double.valueOf(0.0d), within(Double.valueOf(0.2d)));
+ }
+ private double notification() {
+ return Double.valueOf(1.1d);
+ }
+ }
+ """
+ )
+
+ @Test
+ fun floatCloseToWithNoMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(2.0f, notification(), 0.2f);
+ }
+ private Float notification() {
+ return 0.1f;
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).isNotCloseTo(2.0f, within(0.2f));
+ }
+ private Float notification() {
+ return 0.1f;
+ }
+ }
+ """
+ )
+
+ @Test
+ fun floatCloseToWithMessage() = assertRefactored(
+ before = """
+ import org.junit.Test;
+
+ import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertNotEquals(2.0f, notification(), 0.2f, "These should not be close.");
+ }
+ private float notification() {
+ return 0.1f;
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+ import static org.assertj.core.api.Assertions.within;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).as("These should not be close.").isNotCloseTo(2.0f, within(0.2f));
+ }
+ private float notification() {
+ return 0.1f;
+ }
+ }
+ """
+ )
+
+ @Test
+ fun fullyQualifiedMethodWithMessage() = assertRefactored(
+ before = """
+ import java.io.File;
+ import org.junit.Test;
+
+ public class A {
+
+ @Test
+ public void test() {
+ org.junit.jupiter.api.Assertions.assertNotEquals(new File("otherFile"), notification(), "These should not be equal");
+ }
+ private File notification() {
+ return new File("someFile");
+ }
+ }
+ """,
+ after = """
+ import org.junit.Test;
+
+ import java.io.File;
+
+ import static org.assertj.core.api.Assertions.assertThat;
+
+ public class A {
+
+ @Test
+ public void test() {
+ assertThat(notification()).as("These should not be equal").isNotEqualTo(new File("otherFile"));
+ }
+ private File notification() {
+ return new File("someFile");
+ }
+ }
+ """
+ )
+
+}
\ No newline at end of file
diff --git a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertTrueToAssertThatTest.kt b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertTrueToAssertThatTest.kt
index ab6f37f42..99267e954 100644
--- a/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertTrueToAssertThatTest.kt
+++ b/src/test/kotlin/org/openrewrite/java/testing/junitassertj/AssertTrueToAssertThatTest.kt
@@ -92,7 +92,7 @@ class AssertTrueToAssertThatTest: RefactorVisitorTestForParser 0).withFailMessage("The notification should be positive").isTrue();
+ assertThat(notification() != null && notification() > 0).as("The notification should be positive").isTrue();
}
private Integer notification() {
return 1;
@@ -165,7 +165,7 @@ class AssertTrueToAssertThatTest: RefactorVisitorTestForParser 0).isTrue();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be positive").isTrue();
+ assertThat(notification() != null && notification() > 0).as("The notification should be positive").isTrue();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be positive").isTrue();
}
private Integer notification() {
@@ -206,7 +206,7 @@ class AssertTrueToAssertThatTest: RefactorVisitorTestForParser 0).isTrue();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be positive").isTrue();
+ assertThat(notification() != null && notification() > 0).as("The notification should be positive").isTrue();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be positive").isTrue();
}
private Integer notification() {
@@ -251,7 +251,7 @@ class AssertTrueToAssertThatTest: RefactorVisitorTestForParser 0).isTrue();
- assertThat(notification() != null && notification() > 0).withFailMessage("The notification should be positive").isTrue();
+ assertThat(notification() != null && notification() > 0).as("The notification should be positive").isTrue();
assertThat(notification() != null && notification() > 0).withFailMessage(() -> "The notification should be positive").isTrue();
assertTrue(() -> notification() != null && notification() > 0);
assertTrue(() -> notification() != null && notification() > 0, "The notification should be positive");