use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class ArbitraryFileWidgetTest method setup.
@Before
public void setup() {
mediaUtils = mock(MediaUtils.class);
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
return mediaUtils;
}
});
when(mediaUtils.isAudioFile(any())).thenReturn(true);
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class BackgroundAudioPermissionDialogFragmentTest method setup.
@Before
public void setup() {
backgroundAudioViewModel = mock(BackgroundAudioViewModel.class);
fakePermissionsProvider = new FakePermissionsProvider();
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public BackgroundAudioViewModel.Factory providesBackgroundAudioViewModelFactory(AudioRecorder audioRecorder, SettingsProvider settingsProvider, PermissionsChecker permissionsChecker, Analytics analytics) {
return new BackgroundAudioViewModel.Factory(audioRecorder, settingsProvider.getUnprotectedSettings(), permissionsChecker, System::currentTimeMillis) {
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
return (T) backgroundAudioViewModel;
}
};
}
@Override
public PermissionsProvider providesPermissionsProvider(PermissionsChecker permissionsChecker) {
return fakePermissionsProvider;
}
});
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class AudioRecordingControllerFragmentTest method setup.
@Before
public void setup() throws IOException {
File stubRecording = File.createTempFile("test", ".m4a");
stubRecording.deleteOnExit();
audioRecorder = new StubAudioRecorder(stubRecording.getAbsolutePath());
backgroundAudioViewModel = mock(BackgroundAudioViewModel.class);
formEntryViewModel = mock(FormEntryViewModel.class);
hasBackgroundRecording = new MutableNonNullLiveData<>(false);
when(formEntryViewModel.hasBackgroundRecording()).thenReturn(hasBackgroundRecording);
isBackgroundRecordingEnabled = new MutableNonNullLiveData<>(false);
when(backgroundAudioViewModel.isBackgroundRecordingEnabled()).thenReturn(isBackgroundRecordingEnabled);
externalWebPageHelper = mock(ExternalWebPageHelper.class);
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public BackgroundAudioViewModel.Factory providesBackgroundAudioViewModelFactory(AudioRecorder audioRecorder, SettingsProvider settingsProvider, PermissionsChecker permissionsChecker, Analytics analytics) {
return new BackgroundAudioViewModel.Factory(audioRecorder, settingsProvider.getUnprotectedSettings(), permissionsChecker, System::currentTimeMillis) {
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
return (T) backgroundAudioViewModel;
}
};
}
@Override
public FormEntryViewModel.Factory providesFormEntryViewModelFactory(Analytics analytics) {
return new FormEntryViewModel.Factory(System::currentTimeMillis) {
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
return (T) formEntryViewModel;
}
};
}
@Override
public AudioRecorder providesAudioRecorder(Application application) {
return audioRecorder;
}
@Override
public ExternalWebPageHelper providesExternalWebPageHelper() {
return externalWebPageHelper;
}
});
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class AudioRecordingFormErrorDialogFragmentTest method setup.
@Before
public void setup() throws Exception {
File stubRecording = File.createTempFile("test", ".m4a");
stubRecording.deleteOnExit();
audioRecorder = new StubAudioRecorder(stubRecording.getAbsolutePath());
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public AudioRecorder providesAudioRecorder(Application application) {
return audioRecorder;
}
});
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class ExVideoWidgetTest method setup.
@Before
public void setup() {
mediaUtils = mock(MediaUtils.class);
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
return mediaUtils;
}
});
when(mediaUtils.isVideoFile(any())).thenReturn(true);
}
Aggregations