title: How to mock Mono.create
body: <p>I'm using the spock framework and need to return a mocked Mono from a Mono.create(..)</p>
  
  <p>I've tried:</p>
  
  <pre class="lang-groovy prettyprint-override"><code>GroovyMock(Mono)
  </code></pre>
  
  <p>as well as</p>
  
  <pre class="lang-groovy prettyprint-override"><code>GroovyMock(Mono, global:true)
  1 * Mono.create(_ as MonoSink) &gt;&gt; Mono.just(returnedValue)
  </code></pre>
  
  <p>But I get the message that there were too few assertions for the above code.</p>
  
  <p>Here is the actual Mono.create code</p>
  
  <pre class="lang-groovy prettyprint-override"><code>Mono.create{ sink -&gt; 
      myAPISoap.getStuffAsync(
              username, 
              password, 
              info, 
              { outputFuture -&gt; 
                  try {
                      sink.success(outputFuture.get())
                  } catch(Exception e){
                      sink.error(e)
                  } 
              }
      )
  }
  </code></pre>