@Test public void showsAlertIfSaveFailed() throws Exception { controller.identityRepository = mock(IdentityRepository.class); doThrow(new PersistenceException("fail")).when(controller.identityRepository).save(identity); controller.saveIdentity(); waitUntil(() -> controller.getAlert() != null && controller.getAlert().getAlert().isShowing()); }
@FXML void saveIdentity() { long start = currentTimeMillis(); updateIdentityFromView(); showUploadProgress(); CheckedRunnable timer = () -> sleep(max(0, MIN_SPIN_TIME - (currentTimeMillis() - start))); new Thread(() -> saveAndUpload(timer)).start(); }
IdentityEditController extends AbstractController implements Initializable { @FXML void saveIdentity() { long start = currentTimeMillis(); updateIdentityFromView(); showUploadProgress(); CheckedRunnable timer = () -> sleep(max(0, MIN_SPIN_TIME - (currentTimeMillis() - start))); new Thread(() -> saveAndUpload(timer)).start(); } }
IdentityEditController extends AbstractController implements Initializable { @FXML void saveIdentity() { long start = currentTimeMillis(); updateIdentityFromView(); showUploadProgress(); CheckedRunnable timer = () -> sleep(max(0, MIN_SPIN_TIME - (currentTimeMillis() - start))); new Thread(() -> saveAndUpload(timer)).start(); }  }
IdentityEditController extends AbstractController implements Initializable { @FXML void saveIdentity() { long start = currentTimeMillis(); updateIdentityFromView(); showUploadProgress(); CheckedRunnable timer = () -> sleep(max(0, MIN_SPIN_TIME - (currentTimeMillis() - start))); new Thread(() -> saveAndUpload(timer)).start(); }  @Override void initialize(URL location, ResourceBundle resources); void onFinish(Runnable finishHandler); }
IdentityEditController extends AbstractController implements Initializable { @FXML void saveIdentity() { long start = currentTimeMillis(); updateIdentityFromView(); showUploadProgress(); CheckedRunnable timer = () -> sleep(max(0, MIN_SPIN_TIME - (currentTimeMillis() - start))); new Thread(() -> saveAndUpload(timer)).start(); }  @Override void initialize(URL location, ResourceBundle resources); void onFinish(Runnable finishHandler);  }