use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckMetaValidationHookTest method verifyEventValidationFailsWhenOrgUnitIsNotPresentInDb.
@Test
void verifyEventValidationFailsWhenOrgUnitIsNotPresentInDb() {
// given
Event event = validEvent();
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
// when
when(ctx.getProgram(PROGRAM_UID)).thenReturn(new Program());
when(ctx.getProgramStage(PROGRAM_STAGE_UID)).thenReturn(new ProgramStage());
validatorToTest.validateEvent(reporter, event);
// then
hasTrackerError(reporter, E1011, EVENT, event.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckMetaValidationHookTest method verifyEventValidationFailsWhenProgramStageIsNotPresentInDb.
@Test
void verifyEventValidationFailsWhenProgramStageIsNotPresentInDb() {
// given
Event event = validEvent();
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
// when
when(ctx.getOrganisationUnit(ORG_UNIT_UID)).thenReturn(new OrganisationUnit());
when(ctx.getProgram(PROGRAM_UID)).thenReturn(new Program());
validatorToTest.validateEvent(reporter, event);
// then
hasTrackerError(reporter, E1013, EVENT, event.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckMetaValidationHookTest method verifyEventValidationFailsWhenProgramIsNotPresentInDb.
@Test
void verifyEventValidationFailsWhenProgramIsNotPresentInDb() {
// given
Event event = validEvent();
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
// when
when(ctx.getOrganisationUnit(ORG_UNIT_UID)).thenReturn(new OrganisationUnit());
when(ctx.getProgramStage(PROGRAM_STAGE_UID)).thenReturn(new ProgramStage());
validatorToTest.validateEvent(reporter, event);
// then
hasTrackerError(reporter, E1010, EVENT, event.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckMetaValidationHookTest method verifyEnrollmentValidationFailsWhenProgramIsNotPresentInDb.
@Test
void verifyEnrollmentValidationFailsWhenProgramIsNotPresentInDb() {
// given
Enrollment enrollment = validEnrollment();
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
// when
when(ctx.getOrganisationUnit(ORG_UNIT_UID)).thenReturn(new OrganisationUnit());
when(ctx.getTrackedEntityInstance(TRACKED_ENTITY_UID)).thenReturn(new TrackedEntityInstance());
validatorToTest.validateEnrollment(reporter, enrollment);
// then
hasTrackerError(reporter, E1069, ENROLLMENT, enrollment.getUid());
}
use of org.hisp.dhis.tracker.report.ValidationErrorReporter in project dhis2-core by dhis2.
the class PreCheckMetaValidationHookTest method verifyTrackedEntityValidationFailsWhenOrgUnitIsNotPresentInDb.
@Test
void verifyTrackedEntityValidationFailsWhenOrgUnitIsNotPresentInDb() {
// given
TrackedEntity tei = validTei();
ValidationErrorReporter reporter = new ValidationErrorReporter(ctx);
// when
when(ctx.getTrackedEntityType(TRACKED_ENTITY_TYPE_UID)).thenReturn(new TrackedEntityType());
validatorToTest.validateTrackedEntity(reporter, tei);
// then
hasTrackerError(reporter, E1049, TRACKED_ENTITY, tei.getUid());
}
Aggregations