title: Mockito with testfx
body: <p>I have an application and connect database with a gateway module. And I write gui tests and I start to use mockito. I try to update an object with open gui. I  set combobox, textfield parameters and change them new parameters too but then call save method. My problem starts with save method.</p>
  
  <p>I load my controller with</p>
  
  <pre><code>Platform.runlater(() -&gt; {
    spyUpdate.loadItems(object1, object2);
  });
  </code></pre>
  
  <p>I change object parameters and click to save button with </p>
  
  <pre><code>Button saveButton = find("#saveButton");
  click(saveButton);
  </code></pre>
  
  <p>it calls save method. But this method goes to db so I write </p>
  
  <pre><code>Mockito.doNothing().when(spyUpdate).saveObjectToDb();
  </code></pre>
  
  <p>but this is not working? <code>SaveObjectToDb</code> function is called. Is there any idea. Using TestFX and Mockito how can I test my gui?</p>
  
  <p><strong>UPDATED</strong>:</p>
  
  <pre><code>//Button saveButton = find("#saveButton");
  //click(saveButton);
  
    Mockito.doAnswer(new Answer() {
      @Override
      public Object answer(InvocationOnMock invocationOnMock) throws Throwable{
           Platform.runLater(() -&gt;){
               AlertManager.setSUCCESS();
           });
          return null;
     }).when(spyUpdate).saveObjectToDb();
  
  spyUpdate.saveObjectToDb();
  </code></pre>