use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckExistenceValidationHookTest method verifyTrackedEntityValidationSuccessWhenIsUpdate.
@Test
void verifyTrackedEntityValidationSuccessWhenIsUpdate() {
// given
TrackedEntity trackedEntity = TrackedEntity.builder().trackedEntity(TEI_UID).build();
// 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 PreCheckExistenceValidationHookTest method verifyEnrollmentValidationFailsWhenIsUpdateAndEnrollmentIsNotPresent.
@Test
void verifyEnrollmentValidationFailsWhenIsUpdateAndEnrollmentIsNotPresent() {
// given
Enrollment enrollment = Enrollment.builder().enrollment(NOT_PRESENT_ENROLLMENT_UID).build();
// when
when(ctx.getStrategy(enrollment)).thenReturn(TrackerImportStrategy.UPDATE);
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEnrollment(reporter, enrollment);
// then
hasTrackerError(reporter, E1081, ENROLLMENT, enrollment.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckExistenceValidationHookTest method verifyEventValidationFailsWhenIsCreateAndEventIsAlreadyPresent.
@Test
void verifyEventValidationFailsWhenIsCreateAndEventIsAlreadyPresent() {
// given
Event event = Event.builder().event(EVENT_UID).build();
// when
when(ctx.getStrategy(event)).thenReturn(TrackerImportStrategy.CREATE);
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEvent(reporter, event);
// then
hasTrackerError(reporter, E1030, EVENT, event.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckExistenceValidationHookTest method verifyEnrollmentValidationSuccessWhenIsCreateAndEnrollmentIsNotPresent.
@Test
void verifyEnrollmentValidationSuccessWhenIsCreateAndEnrollmentIsNotPresent() {
// given
Enrollment enrollment = Enrollment.builder().enrollment(NOT_PRESENT_ENROLLMENT_UID).build();
// when
when(ctx.getStrategy(enrollment)).thenReturn(TrackerImportStrategy.CREATE);
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 PreCheckExistenceValidationHookTest method verifyEventValidationSuccessWhenEventIsNotPresent.
@Test
void verifyEventValidationSuccessWhenEventIsNotPresent() {
// given
Event event = Event.builder().event(NOT_PRESENT_EVENT_UID).build();
// when
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
validationHook.validateEvent(reporter, event);
// then
assertFalse(reporter.hasErrors());
}
Aggregations