use of org.opendatakit.briefcase.export.ExportEvent in project briefcase by opendatakit.
the class ExportPanelUnitTest method saves_to_user_preferences_the_last_successful_export_date_for_a_form.
@Test
public void saves_to_user_preferences_the_last_successful_export_date_for_a_form() {
List<FormStatus> formsList = FormStatusBuilder.buildFormStatusList(10);
BriefcasePreferences inMemoryPrefs = new BriefcasePreferences(InMemoryPreferences.empty());
initialDefaultConf = empty().build();
ExportForms forms = load(initialDefaultConf, formsList, inMemoryPrefs);
ExportPanelForm exportPanelForm = ExportPanelForm.from(forms, inMemoryPrefs, inMemoryPrefs, initialDefaultConf);
new ExportPanel(forms, exportPanelForm, inMemoryPrefs, inMemoryPrefs, inMemoryPrefs, new NoOpAnalytics(), FormCache.empty(), new FakeHttp(), new InMemoryFormMetadataAdapter());
FormStatus form = formsList.get(0);
String formId = form.getFormDefinition().getFormId();
assertThat(inMemoryPrefs.nullSafeGet(buildExportDateTimePrefix(formId)), isEmpty());
FormDefinition formDef = FormDefinition.from((BriefcaseFormDefinition) form.getFormDefinition());
ExportEvent event = ExportEvent.successForm(formDef, 10);
forms.appendStatus(event);
assertThat(inMemoryPrefs.nullSafeGet(buildExportDateTimePrefix(formId)), isPresent());
}
Aggregations