title: How to test method that throws error in Swift 2?
body: <p>This is my method definition:</p>
  
  <pre><code>func isValidForMode(mode: DBFindViewControllerMode) throws -&gt; Bool { }
  </code></pre>
  
  <p>Now I can test this in simple way, since I know that it <strong>DO NOT</strong> throws an error:</p>
  
  <pre><code>XCTAssertTrue(try! searchOptionsManager.isValidForMode(.Address))
  </code></pre>
  
  <p>But what if I know that method throws?</p>
  
  <p>The best solution would be <code>XCTAssertThrows()</code>, but it is not:-)</p>
  
  <p>Below is my try:</p>
  
  <pre><code>do {
      try searchOptionsManager.isValidForMode(.Address)
  } catch let error {
      XCTAssertEqual(error as! DBErrorType, DBErrorType.CannotBeEmpty("Street"))
  }
  </code></pre>
  
  <p>But it fails, because:</p>
  
  <blockquote>
    <p>Cannot find an overload for <code>XCTAssertEqual</code> that accepts an argument list of type <code>(DBErrorType, DBErrorType)</code></p>
  </blockquote>