title: How to mock a uuid generator which return different values for different calls?
body: <p>I have a uuid generator, like:</p>
  
  <pre><code>class NewUuid {
      def apply: String = UUID.randomUUID().toString.replace("-", "")
  }
  </code></pre>
  
  <p>And other class can use it:</p>
  
  <pre><code>class Dialog {
      val newUuid = new NewUuid
      def newButtons(): Seq[Button] = Seq(new Button(newUuid()), new Button(newUuid()))
  }
  </code></pre>
  
  <p>Now I want to test the <code>Dialog</code> and mock the <code>newUuid</code>:</p>
  
  <pre><code>val dialog = new Dialog {
      val newUuid = mock[NewUuid]
      newUuid.apply returns "uuid1"
  }
  dialog.newButtons().map(_.text) === Seq("uuid1", "uuid1")
  </code></pre>
  
  <p>You can see the returned uuid is always <code>uuid1</code>.</p>
  
  <p>Is it possible to let <code>newUuid</code> to return different values for different calls? e.g. The first call returns <code>uuid1</code>, the second returns <code>uuid2</code>, etc</p>