title: Test if a function is called in a given scope in scala
body: <p>I'm following the scala course in coursera and I was asked to implement set operations in the last exercise. One of the test I failed was called </p>
  
  <blockquote>
    <p>exists should be implemented in terms of forall</p>
  </blockquote>
  
  <p>Both exists and forall signatures are :</p>
  
  <pre><code>type Set = Int =&gt; Boolean
  
  def forall(s: Set, p: Int =&gt; Boolean): Boolean = {}
  def exists(s: Set, p: Int =&gt; Boolean): Boolean = {
  
     /*should eventually call forall */
  }
  </code></pre>
  
  <p>I am not asking for the implementation, but how to perform such a unit test in scala</p>