Reimplement the message-accepting overload of fail(...) in terms of withMessage(...).

This has a few minor effects:

- The message now comes before any "value of" line, rather than after. (This requires updating a couple tests in Truth. It's very rare for people to use fail(...) in the way that we do, though: Most people make simple calls like assert_().fail(...), not complex ones from inside Subjects like our tests do.)
- fail("foo") used to include "foo" as a Fact. Now, it includes it as a message. (This distinction is mostly irrelvant except for one test I found that was using TruthFailureSubject to look specifically for a Fact. I've updated it.)
- fail(...) no longer accepts a null message. (It's still possible to write fail("%s", somethingNull), and if you switch to calling withMessage(...).fail() directly, then that accepts a null message, too, if you're passing only one arg. This change appears to affect no one.)

Also, add a test that calls fail() to catch the bug that I almost introduced with empty messages.

And tweak some docs.

(Part of this was pulled out from CL 254051742.)

RELNOTES=Reimplemented the message-accepting overload of `fail(...)` in terms of `withMessage(...)`. This is mostly a no-op but can affect behavior in unusual cases. For details, see the commit description.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=254642313
5 files changed
tree: 599f6fab3326f19f860bf49b93c44ab1263ced1d
  1. core/
  2. extensions/
  3. refactorings/
  4. util/
  5. .gitignore
  6. .travis.yml
  7. CONTRIBUTING.md
  8. LICENSE
  9. pom.xml
  10. README.md
README.md

Main Site Build Status Maven Release Stackoverflow

What is Truth?

Truth makes your test assertions and failure messages more readable. Similar to AssertJ, it natively supports many JDK and Guava types, and it is extensible to others.

Truth is owned and maintained by the Guava team. It is used in the majority of the tests in Google’s own codebase.

Read more at the main website.