use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testGetStudy.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-after-updating-description.xml")
@ExpectedDatabase(value = "/data/study/study-after-updating-description.xml", assertionMode = NON_STRICT)
public void testGetStudy() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/study-management/studies/" + STUDY_ID)).andExpect(NO_ERROR_CODE).andExpect(jsonPath("$.result.id").isNotEmpty()).andReturn();
JSONAssert.assertEquals(UPDATED_STUDY_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup 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.DatabaseSetup in project ArachneCentralAPI by OHDSI.
the class SkillControllerTests method testGetSkill.
@Test
@DatabaseSetup("/data/skill/skill-after-updating.xml")
@ExpectedDatabase(value = "/data/skill/skill-after-updating.xml", assertionMode = NON_STRICT)
public void testGetSkill() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/user-management/skills/" + SKILL_ID)).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.
the class SkillControllerTests method testCreateSkill.
@Test
@DatabaseSetup("/data/skill/empty-skill.xml")
@ExpectedDatabase(value = "/data/skill/added-skill.xml", assertionMode = NON_STRICT)
public void testCreateSkill() throws Exception {
SkillDTO skillDTO = new SkillDTO();
skillDTO.setName(SKILL_NAME);
MvcResult mvcResult = mvc.perform(post("/api/v1/user-management/skills/").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(skillDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.
the class StudyTypeControllerTests method testGetStudyType.
@Test
@DatabaseSetup("/data/study/type/study-type-after-updating.xml")
@ExpectedDatabase(value = "/data/study/type/study-type-after-updating.xml", assertionMode = NON_STRICT)
public void testGetStudyType() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/study-management/study-types/" + ID)).andExpect(OK_STATUS).andReturn();
JSONAssert.assertEquals(UPDATED_STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Aggregations