@Test public void testExceptionHandling() throws IOException { FormTree formTree = assertResolves(formTreeBuilder.apply(HOUSEHOLD_SURVEY_FORM_CLASS)); importModel = new ImportModel(formTree); // Step 1: User pastes in data to import PastedTable source = new PastedTable( Resources.toString( getResource("org/activityinfo/core/shared/importing/qis.csv"), Charsets.UTF_8)); importModel.setSource(source); importer = new Importer( resourceLocator, formTree, FieldImportStrategies.get(JvmConverterFactory.get())); importModel.setColumnAction(columnIndex("MEMBER_NO_ADULT_FEMALE"), target("NumAdultMale")); importModel.setColumnAction(columnIndex("MEMBER_NO_ADULT_FEMALE"), target("NumAdultFemale")); importModel.setColumnAction(columnIndex("_CREATION_DATE"), target("Start Date")); importModel.setColumnAction(columnIndex("_SUBMISSION_DATE"), target("End Date")); importModel.setColumnAction(columnIndex("district"), target("District Name")); importModel.setColumnAction(columnIndex("upazila"), target("Upzilla Name")); // importModel.setColumnAction(columnIndex("Partner"), target("Partner Name")); Promise<Void> result = importer.persist(importModel); assertThat(result.getState(), equalTo(Promise.State.REJECTED)); }
public Promise<Void> fetch(ResourceLocator locator, Set<ResourceId> ids) { if (ids == null || ids.isEmpty()) { return Promise.done(); } else { return fetchLabelAndParentIds(locator, ids); } }