February 2013
Intermediate to advanced
258 pages
7h 26m
English
Never-failing tests are like Chuck Norris—they never fail—and that’s a bad thing. A test that can’t fail has no value, as it will never alert you to a mishap. A test that can never fail is probably worse than not having that test, as it creates a false sense of security.
Perhaps the single most common context where never-failing tests are found is in tests that check for an expected exception to be thrown.[5] Here is an example of such a test.
5 Another common type of a never-failing test is a test without assertions.
@Test public void includeForMissingResourceFails() { try { new Environment().include("somethingthatdoesnotexist"); } catch (IOException e) { assertThat(e.getMessage(), ...