use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyEndDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-end-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyEndDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setEndDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_END_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyStartDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-start-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyStartDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setStartDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_START_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleToDatasetOwner.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-before-changing-role.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-before-changing-role.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleToDatasetOwner() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(DATA_SET_OWNER.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + 2L).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(jsonPath("$.errorCode").value(VALIDATION_ERROR.getCode()));
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testAddParticipant.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-after-updating-description.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-after-add.xml", assertionMode = NON_STRICT) })
public void testAddParticipant() throws Exception {
AddStudyParticipantDTO participantDTO = new AddStudyParticipantDTO();
participantDTO.setUserId(USER_2_UUID);
participantDTO.setRole(CONTRIBUTOR);
mvc.perform(post("/api/v1/study-management/studies/" + STUDY_ID + "/participants").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(NO_ERROR_CODE).andReturn();
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleToLeadInvestigator.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-before-changing-role.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-2-leaders.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleToLeadInvestigator() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(LEAD_INVESTIGATOR.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + UserIdUtils.idToUuid(2L)).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(NO_ERROR_CODE).andReturn();
}
Aggregations