title: Assert that the correct exception is thrown
body: <p>I have a method <code>ESV.allocate(BLOCK_NUMBER + 1)</code> that only returns an <code>Exception</code> wrapped in a <code>Failure</code>:</p>
  
  <pre><code>Failure(new Exception("Tried to allocate more than available memory"))
  </code></pre>
  
  <p>However, I'm not sure how to test that.</p>
  
  <p>I tried using FunSuite and I put this in my unit test:</p>
  
  <pre><code>assert(ESV.allocate(BLOCK_NUMBER + 1) == Failure(new Exception("Tried to allocate more than available memory")))
  </code></pre>
  
  <p>However, the test fails with this message:</p>
  
  <pre><code> Failure(java.lang.Exception: Tried to allocate more than available memory) did not equal Failure(java.lang.Exception: Tried to allocate more than available memory)
  </code></pre>
  
  <p>This is probably because I am instantiating a different <code>Exception</code> object in the assert, and it doesn't compare as equal to the one returned by the method I am testing.</p>
  
  <p>So how can I check the result returned by the method?</p>