Ran
|
Files
91
|
Run time
11s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
<a href="https://github.com/se-edu/addressbook-level4/commit/<a class=hub.com/se-edu/addressbook-level4/commit/e186102b646d2307b53928142dd22932a6f4c86d">e186102b6<a href="https://github.com/se-edu/addressbook-level4/commit/e186102b646d2307b53928142dd22932a6f4c86d">">Replace uses of `org.junit.Assert.fail` with `throw new AssertionError(...)` The source code of `org.junit.Assert.fail(String)` is[1]: public static void fail(String message) { if (message == null) { throw new AssertionError(); } throw new AssertionError(message); } where `AssertionError` is our favorite `java.lang.AssertionError`. In other words, calling `fail(String)` is no different from writing `throw new AssertionError(...)`. The latter has a further benefit, though -- it informs the Java compiler that the code path terminates at that point. This is useful when we are inside a function that has a non-void return type -- if we used `fail(String)`, we will still need to `return` a dummy value at the end to satisfy the compiler, whereas if we used `throw new AssertionError(...)` we do not need to do that. So, let&#39;s use `throw new AssertionError(...)` consistently throughout the code base. [1] https://github.com/junit-team/junit4/blob/</a><a class="double-link" href="https://github.com/se-edu/addressbook-level4/commit/<a class="double-link" href="https://github.com/se-edu/addressbook-level4/commit/02c328028b4d32c15bbf0becc9838e54ecbafcbf">02c328028</a>">02c328028</a><a href="https://github.com/se-edu/addressbook-level4/commit/e186102b646d2307b53928142dd22932a6f4c86d">/src/main/java/org/junit/Assert.java#L85-L90
1428 of 1549 relevant lines covered (92.19%)
0.92 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|