Search in sources :

Example 1 with MapProvider

use of org.odk.collect.android.geo.MapProvider in project collect by opendatakit.

the class FormMapActivityTest method setUpActivity.

@Before
public void setUpActivity() {
    CollectHelpers.setupDemoProject();
    AppDependencyComponent component = CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MapProvider providesMapProvider() {
            MapProvider mapProvider = mock(MapProvider.class);
            when(mapProvider.createMapFragment(ArgumentMatchers.any())).thenReturn(map);
            return mapProvider;
        }
    });
    FormsRepository formsRepository = component.formsRepositoryProvider().get();
    instancesRepository = component.instancesRepositoryProvider().get();
    form = formsRepository.save(testForm);
    Arrays.stream(testInstances).forEach(instancesRepository::save);
    Intent intent = new Intent();
    intent.putExtra(FormMapActivity.EXTRA_FORM_ID, form.getDbId());
    activityController = CollectHelpers.buildThemedActivity(FormMapActivity.class, intent);
    activity = (FormMapActivity) activityController.get();
    activityController.setup();
}
Also used : MapProvider(org.odk.collect.android.geo.MapProvider) FormsRepository(org.odk.collect.forms.FormsRepository) AppDependencyComponent(org.odk.collect.android.injection.config.AppDependencyComponent) Intent(android.content.Intent) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Before(org.junit.Before)

Aggregations

Intent (android.content.Intent)1 Before (org.junit.Before)1 MapProvider (org.odk.collect.android.geo.MapProvider)1 AppDependencyComponent (org.odk.collect.android.injection.config.AppDependencyComponent)1 AppDependencyModule (org.odk.collect.android.injection.config.AppDependencyModule)1 FormsRepository (org.odk.collect.forms.FormsRepository)1