use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class EnrollmentAttrValidationTest method testAttributesMissingValues.
@Test
void testAttributesMissingValues() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/enrollments_te_attr-missing-value.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(1, trackerImportReport.getValidationReport().getErrors().size());
assertThat(trackerImportReport.getValidationReport().getErrors(), everyItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1076))));
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class EnrollmentAttrValidationTest method testAttributesUniquenessInSameTei.
@Test
void testAttributesUniquenessInSameTei() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/enrollments_te_unique_attr_same_tei.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(0, trackerImportReport.getValidationReport().getErrors().size());
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class EnrollmentAttrValidationTest method failValidationWhenTrackedEntityAttributeHasWrongOptionValue.
@Test
void failValidationWhenTrackedEntityAttributeHasWrongOptionValue() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/enrollments_te_with_invalid_option_value.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(1, trackerImportReport.getValidationReport().getErrors().size());
assertThat(trackerImportReport.getValidationReport().getErrors(), everyItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1125))));
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class EnrollmentAttrValidationTest method successValidationWhenTrackedEntityAttributeHasValidOptionValue.
@Test
void successValidationWhenTrackedEntityAttributeHasValidOptionValue() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/enrollments_te_with_valid_option_value.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(0, trackerImportReport.getValidationReport().getErrors().size());
}
use of org.hisp.dhis.tracker.report.TrackerImportReport in project dhis2-core by dhis2.
the class EnrollmentAttrValidationTest method testAttributesMissingMandatory.
@Test
void testAttributesMissingMandatory() throws IOException {
TrackerImportParams params = createBundleFromJson("tracker/validations/enrollments_te_attr-missing-mandatory.json");
params.setImportStrategy(TrackerImportStrategy.CREATE);
TrackerImportReport trackerImportReport = trackerImportService.importTracker(params);
assertEquals(1, trackerImportReport.getValidationReport().getErrors().size());
assertThat(trackerImportReport.getValidationReport().getErrors(), everyItem(hasProperty("errorCode", equalTo(TrackerErrorCode.E1018))));
}
Aggregations