Commit 3545e9e8 authored by Gerson Sunyé's avatar Gerson Sunyé

Add new slide containing assertion failure messages

parent 81b15351
Pipeline #15571 passed with stages
in 39 seconds
......@@ -17,6 +17,7 @@ TODO
* making "fast" and "slow" tests for different executions
* add a JUnit Integration Test
* Use Truth assertions inside JUnit test cases
* Add a Static Analysis Example
////
= Software Testing
......@@ -689,6 +690,31 @@ assertThat(aComparable).isIn(Range.closed(1, 10));
* Prevents writing complex assertion logic
* More descriptive failure messages
== Failure messages
.Assertions:
[source,jav]
----
assert "one".equals("two") : "One and two are different";
assertThat("one").isEqualTo("two"); // Truth
----
.Java Failure Message:
[source,sh]
----
Exception in thread "main" java.lang.AssertionError: One and two are different
at fr.unantes.sce.Main.main(Main.java:13)
----
.Truth Failure Message:
[source,sh]
----
Exception in thread "main" expected: two
but was : one
at fr.unantes.sce.Main.main(Main.java:14)
----
[.impact]
== JUnit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment