use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class BasePaperControllerTest method testCreatePaper.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@ExpectedDatabase(value = "/data/paper/papers-after-creation.xml", assertionMode = NON_STRICT)
public void testCreatePaper() throws Exception {
final CreatePaperDTO createPaperDTO = new CreatePaperDTO();
createPaperDTO.setStudyId(1L);
MvcResult mvcResult = mvc.perform(post("/api/v1/papers").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createPaperDTO))).andExpect(OK_STATUS).andReturn();
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class RoleControllerTests method testGetRole.
@Test
@DatabaseSetup(value = "/data/role/roles.xml")
@ExpectedDatabase(table = "roles", value = "/data/role/roles.xml", assertionMode = NON_STRICT)
public void testGetRole() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/admin/roles/" + ROLE_ID)).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_ROLE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class RoleControllerTests method testRole.
@Test
@DatabaseSetup(value = "/data/role/empty-role.xml")
@ExpectedDatabase(table = "roles", value = "/data/role/added-role.xml", assertionMode = NON_STRICT)
public void testRole() throws Exception {
RoleDTO roleDTO = new RoleDTO();
roleDTO.setName(ROLE_NAME);
roleDTO.setDescription(ROLE_DESCRIPTION);
MvcResult mvcResult = mvc.perform(post("/api/v1/admin/roles/").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(roleDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(ROLE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class ProfessionalTypeControllerTests method testUpdateProfessionalType.
@Test
@DatabaseSetup(value = "/data/professionaltype/professional-type-before-updating.xml")
@ExpectedDatabase(table = "professional_types", value = "/data/professionaltype/professional-type-after-updating.xml", assertionMode = NON_STRICT)
public void testUpdateProfessionalType() throws Exception {
CommonProfessionalTypeDTO professionalTypeDTO = new CommonProfessionalTypeDTO();
professionalTypeDTO.setName(UPDATED_PROFESSIONAL_TYPE_NAME);
professionalTypeDTO.setId(PROFESSIONAL_TYPE_ID);
MvcResult mvcResult = mvc.perform(put("/api/v1/admin/professional-types/" + PROFESSIONAL_TYPE_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(professionalTypeDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_PROFESSIONAL_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class SkillControllerTests method testUpdateSkill.
@Test
@DatabaseSetup("/data/skill/skill-before-updating.xml")
@ExpectedDatabase(value = "/data/skill/skill-after-updating.xml", assertionMode = NON_STRICT)
public void testUpdateSkill() throws Exception {
SkillDTO skillDTO = new SkillDTO();
skillDTO.setId(SKILL_ID);
skillDTO.setName(UPDATED_SKILL_NAME);
MvcResult mvcResult = mvc.perform(put("/api/v1/admin/skills/" + SKILL_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(skillDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Aggregations