use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckUpdatableFieldsValidationHookTest method verifyTrackedEntityValidationSuccess.
@Test
void verifyTrackedEntityValidationSuccess() {
// given
TrackedEntity trackedEntity = validTei();
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateTrackedEntity(reporter, trackedEntity);
// then
assertFalse(reporter.hasErrors());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckUpdatableFieldsValidationHookTest method verifyEventValidationSuccess.
@Test
void verifyEventValidationSuccess() {
// given
Event event = validEvent();
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEvent(reporter, event);
// then
assertFalse(reporter.hasErrors());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckUpdatableFieldsValidationHookTest method verifyEnrollmentValidationSuccess.
@Test
void verifyEnrollmentValidationSuccess() {
// given
Enrollment enrollment = validEnrollment();
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEnrollment(reporter, enrollment);
// then
assertFalse(reporter.hasErrors());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckUpdatableFieldsValidationHookTest method verifyEventValidationFailsWhenUpdateProgramStage.
@Test
void verifyEventValidationFailsWhenUpdateProgramStage() {
// given
Event event = validEvent();
event.setProgramStage("NewProgramStageId");
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEvent(reporter, event);
// then
hasTrackerError(reporter, E1128, EVENT, event.getUid());
assertThat(reporter.getReportList().get(0).getErrorMessage(), containsString("programStage"));
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckUpdatableFieldsValidationHookTest method verifyEnrollmentValidationFailsWhenUpdateTrackedEntity.
@Test
void verifyEnrollmentValidationFailsWhenUpdateTrackedEntity() {
// given
Enrollment enrollment = validEnrollment();
enrollment.setTrackedEntity("NewTrackedEntityId");
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEnrollment(reporter, enrollment);
// then
hasTrackerError(reporter, E1127, ENROLLMENT, enrollment.getUid());
assertThat(reporter.getReportList().get(0).getErrorMessage(), containsString("trackedEntity"));
}
Aggregations