Search in sources :

Example 6 with StudyTypeDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO in project ArachneCentralAPI by OHDSI.

the class StudyTypeControllerTests method testUpdateStudyType.

@Test
@DatabaseSetup("/data/study/type/study-type-before-updating.xml")
@ExpectedDatabase(value = "/data/study/type/study-type-after-updating.xml", assertionMode = NON_STRICT)
public void testUpdateStudyType() throws Exception {
    StudyTypeDTO dto = new StudyTypeDTO(ID);
    dto.setName(UPDATED_NAME);
    MvcResult mvcResult = mvc.perform(put("/api/v1/admin/study-types/" + ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(dto))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andReturn();
    JSONAssert.assertEquals(UPDATED_STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Also used : MvcResult(org.springframework.test.web.servlet.MvcResult) CreateStudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Aggregations

StudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO)6 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)4 Test (org.junit.Test)4 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)3 CreateStudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO)3 StudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO)3 StudyStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO)3 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)3 CreateStudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO)2 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)1 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)1 NotUniqueException (com.odysseusinc.arachne.portal.exception.NotUniqueException)1 StudyType (com.odysseusinc.arachne.portal.model.StudyType)1 ApiOperation (io.swagger.annotations.ApiOperation)1 LinkedList (java.util.LinkedList)1 ConverterNotFoundException (org.springframework.core.convert.ConverterNotFoundException)1 MvcResult (org.springframework.test.web.servlet.MvcResult)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1