Search in sources :

Example 1 with CurrentProjectProvider

use of org.odk.collect.android.projects.CurrentProjectProvider in project collect by opendatakit.

the class FormSaveViewModelTest method setup.

@Before
public void setup() {
    // Useful given some methods will execute AsyncTasks
    Robolectric.getBackgroundThreadScheduler().pause();
    formController = mock(FormController.class);
    logger = mock(AuditEventLogger.class);
    mediaUtils = mock(MediaUtils.class);
    Analytics analytics = mock(Analytics.class);
    when(formController.getAuditEventLogger()).thenReturn(logger);
    when(logger.isChangeReasonRequired()).thenReturn(false);
    audioRecorder = mock(AudioRecorder.class);
    currentProjectProvider = mock(CurrentProjectProvider.class);
    when(currentProjectProvider.getCurrentProject()).thenReturn(Project.Companion.getDEMO_PROJECT());
    viewModel = new FormSaveViewModel(savedStateHandle, () -> CURRENT_TIME, formSaver, mediaUtils, analytics, scheduler, audioRecorder, currentProjectProvider);
    viewModel.formLoaded(formController);
}
Also used : FormController(org.odk.collect.android.javarosawrapper.FormController) CurrentProjectProvider(org.odk.collect.android.projects.CurrentProjectProvider) FormSaveViewModel(org.odk.collect.android.formentry.saving.FormSaveViewModel) MediaUtils(org.odk.collect.android.utilities.MediaUtils) AudioRecorder(org.odk.collect.audiorecorder.recording.AudioRecorder) Analytics(org.odk.collect.analytics.Analytics) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 Analytics (org.odk.collect.analytics.Analytics)1 FormSaveViewModel (org.odk.collect.android.formentry.saving.FormSaveViewModel)1 FormController (org.odk.collect.android.javarosawrapper.FormController)1 CurrentProjectProvider (org.odk.collect.android.projects.CurrentProjectProvider)1 MediaUtils (org.odk.collect.android.utilities.MediaUtils)1 AudioRecorder (org.odk.collect.audiorecorder.recording.AudioRecorder)1