TrainModel implements UseCase { @Override public void execute() { if (model == null) { callback.onError(new UseCaseError()); } else { model.buildModel(); model.train(dataSource); callback.onSuccess(Boolean.TRUE); } } TrainModel(FederatedModel model, FederatedDataSet dataSource,
                      UseCaseCallback<Boolean> callback); @Override void execute();  }
@Test public void testModelIsTrained() { FederatedModel model = mock(FederatedModel.class); FederatedDataSet dataSource = mock(FederatedDataSet.class); TrainModel cut = new TrainModel(model, dataSource, useCaseCallback); cut.execute(); verify(model).buildModel(); verify(model).train(dataSource); verify(useCaseCallback).onSuccess(Boolean.TRUE); }