title: Scala equivalent of instanceOf Java and exception handling
body: <p>Just started using Scala for unit testing and am totally confused as to how exceptions are handled in Scala. Below is an example of a JUnit test.</p>
  
  <pre><code>class Test {
    @Test
    void someTest {
      try {
        //Something
      } catch(Exception e) {
        Assert.assertTrue(e.getCause() instanceOf IOException);
      }
    }
  } 
  </code></pre>
  
  <p>Now I want to do the same thing in Scala, I tried</p>
  
  <pre><code>class Test {
    @Test def someTest {
      try {
        //Something
      } catch {
        case e: Exception =&gt; assertTrue(e.getCause().isInstanceOf[IOException])
      }
    }
  }
  </code></pre>
  
  <p>But my IDE keeps complaining that <code>Method Apply is not a member of type Any</code>. I read about exception handling in Scala and found that you should use a pattern matcher and that there is <a href="http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-4" rel="nofollow">no exception handling in Scala</a>. How exactly does this work?</p>