title: Practical uses for the option to pass `Supplier` as a message supplier in JUnit 5
body: <p>The <a href="https://junit.org/junit5/docs/current/api/org/junit/jupiter/api/Assertions.html" rel="nofollow noreferrer"><code>Assertions</code></a> class in JUnit 5 allows for passing an <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html" rel="nofollow noreferrer"><code>Supplier&lt;String&gt;</code></a> as a <code>messageSupplier</code>, an object that provides the text of a message to report when the test fails.</p>
  
  <p>For example, <a href="https://junit.org/junit5/docs/current/api/org/junit/jupiter/api/Assertions.html#assertEquals(char,char,java.util.function.Supplier)" rel="nofollow noreferrer"><code>assertEquals</code></a>:</p>
  
  <pre class="lang-java prettyprint-override"><code>public static void assertEquals​( char expected,
                                   char actual,
                                   Supplier&lt;String&gt; messageSupplier )
  </code></pre>
  
  <p>I am wondering what the <strong>practical use of such a supplier</strong> might be, specifically in the context of unit testing. </p>
  
  <p>I can imagine perhaps localizing the strings, though that seems a bit strange to localize when the audience is the members of a development project. </p>
  
  <p>➥ Are there any other practical uses of passing such a message supplier rather than <a href="https://en.wikipedia.org/wiki/Hard_coding" rel="nofollow noreferrer">hard-coding</a> message string?</p>